Posts

Showing posts from January, 2012

php - Call to undefined method HTML_neolegal::legals() -

i converted joomla-1 php-5.6 except 1 component, gives me error: php fatal error: call undefined method html_neolegal::legals() in ../administrator/components/com_neolegal/admin.neolegal.php on line 64 and line 58-65 contains: // id := 1 (only 1 record) function legals( $option ) { global $database; $id = 1; $row = new mosneolegal ( $database ); $row->load( $id ); html_neolegal::legals( $row, $option ); } i know it's because use new php version, need workaround this. it's not possible downgrade. i think there 2 functions same name "legals". try find legals function on html_neolegal class , change function name example legals_new then change call html_neolegal:: legals_new ( $row, $option )...

Displaying images in magento extension backend -

i developing extension , want display images on extension backend page. have stored images in 'images' folder in extension. trying show images using <img> tag. have provided image url in "src" attribute, not showing image @ backend page. in system.xml , using following code:- <myoption translate="label"> <label>my label</label> <frontend_type>radios</frontend_type> <source_model>mymodule/source_buttons</source_model> <sort_order>30</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </myoption> code in model\source\buttons.php file:- <?php class mycompany_mymodule_model_source_buttons { public function tooptionarray() { $result = array(); $result[] = array('value' => '32', 'label'=>'<im...

iphone - proximityMonitoringEnabled for modally presented view controller -

in uiviewcontroller i'm using code snippet works absolutely fine: - (void)viewwillappear:(bool)animated { [super viewwillappear:animated]; [uidevice currentdevice].proximitymonitoringenabled = yes; } then i'm detecting interface rotation changes present uiviewcontroller modally via performing segue: - (void)willrotatetointerfaceorientation:(uiinterfaceorientation)tointerfaceorientation duration:(nstimeinterval)duration { if (tointerfaceorientation == uiinterfaceorientationlandscapeleft || tointerfaceorientation == uiinterfaceorientationlandscaperight) { [self performseguewithidentifier:@"showanotherview" sender:nil]; } } in modally presented view controller i'm doing same, enable proximity monitoring in viewwillappear: unfortunately doesn't work: display doesn't turn off when i'm covering proximity sensor of iphone 5. what doing wrong?

ios - Using iPhones as iBeacons -

i trying app work whereby phone emits ibeacon signal , nearby phones able detect in background , callback method. phone broadcasting signal , phone b monitoring in background , calls method. here code setting up: var centralmanager: cbcentralmanager! var peripheralmanager: cbperipheralmanager = cbperipheralmanager() var locationmanager: cllocationmanager = cllocationmanager() let uuid: nsuuid = nsuuid(uuidstring: "dcef54a2-31eb-467f-af8e-350fb641c97b")! override func viewdidload() { super.viewdidload() self.locationmanager.delegate = self self.locationmanager.requestalwaysauthorization() self.centralmanager = cbcentralmanager(delegate: self, queue: nil) self.peripheralmanager = cbperipheralmanager(delegate: self, queue: nil) let beaconregion = clbeaconregion(proximityuuid: uuid, identifier: "device") locationmanager.startmonitoringforregion(beaconregion) this code using advertising , monitoring beacons: func locationmanager(man...

google apps script - Create student roster from Classroom -

i'm trying pull student information google classroom roster. here have far: function studentroster() { var optionalargs = { pagesize: 2 }; var getstudents = classroom.courses.students.list("757828465",optionalargs).students; logger.log(getstudents); } sandy's answer below helped solve part of problem , log (names, id's, emails , such changed): [16-01-05 17:44:04:734 pst] [{profile={photourl= https://lh3.googleusercontent.com/-xduiqdmkcwa/aaaaaaaaaai/aaaaaaaaaaa/4252rscbv5m/photo.jpg , emailaddress=jsdoe@fjuhsd.org, name={givenname=john, familyname=doe, fullname=john doe}, id=108117124004883828162}, courseid=757828465, userid=108117124004883828162}, {profile={photourl= https://lh3.googleusercontent.com/-xduiqdmkcwa/aaaaaaaaaai/aaaaaaaaaaa/4252rscbv5m/photo.jpg , emailaddress=jhdoe@fjuhsd.org, name={givenname=jane, familyname=doe, fullname=jane doe}, id=115613162385930536688}, courseid=757828465, userid=115613162385930536688}] so question...

html - Is there a way to copy a hyperlink object to the clipboard with just a button push in browser, to paste in email? -

is there way copy hyperlink object clipboard button push in browser, paste in email? this not duplicate question post how trello access user's clipboard? but rather extension of it. post above describes how copy text string. i'm asking how copy hyperlink object (with click of button) can past email. i suggest maybe using clipboard.js in order implement functionality. works without using flash , works.

html - Not displaying SQL data through PHP when using a template file -

i have used template.php file create layout of page , inserting content through $content variable stored in separate file. example of file: <?php $content = ' <table id="job_table"> <tr> <th id="jobtitle">catering assistant</th> <th id="r_code">ref code: 14407773</th> </tr> <tr> <td id="location">northampton</td> <td id="salery">£2,000 monthly</td> </tr> <tr> <td id="description">description</td> <td> assist in catering workers in canteen area. </td> </tr> <tr> <td><a href="apply.php" class="applybutton">apply now!</a></td> <td></td> </tr> <...

sql server - Auto generate by default, first two digits are the last two digits of current year -

i want work ms sql functions. project number should automatically generated default, first 2 digits last 2 digits of current year, ‘-’ last 3 digits serial number based on year. e.g 16-000 next 16-001 on when 2017 comes change again 17-000 , continue. here achievement , need kind of modification throws exception "conversion failed when converting varchar value '16-001' data type int." when portion being execute. set @pid =(select right(convert(varchar(8), year(getdate()), 1),2)) +'-'+ right(@pid,3)+1 my function complete code. create function nextprojectnumber() returns char(6) begin declare @pid varchar(50), @pyear int, @serial varchar(3), @curryear int select @pid = projectid [jobportaldb].[dbo].[projects] projectid=(select max(projectid) [jobportaldb].[dbo].[projects]) set @curryear = (select right(convert(varchar(8), year(getdate()), 1),2)) --select @pid,@year if @pid null set @pid = (select right(con...

easy way to cleanly dump contents of associative array in bash? -

in zsh can dump contents of associative array single command: zsh% typeset -a foo zsh% foo=(a 1 b 2) zsh% typeset foo foo=(a 1 b 2 ) however despite searching high , low, best find declare -p , output contains declare -a : bash$ typeset -a foo bash$ foo=([a]=1 [b]=2) bash$ declare -p foo declare -a foo='([a]="1" [b]="2" )' is there clean way obtain zsh output (ideally foo=(a 1 b 2 ) or foo='([a]="1" [b]="2" )' ), preferably without resorting string manipulation? it seems there no way other string manipulation. @ least can avoid forking sed process each time, e.g.: dump_assoc_arrays () { var in "$@"; read debug < <(declare -p $var) echo "${debug#declare -a }" done }

javascript - Blank window when launching Chrome Packaged app -

when launch chrome packaged app sounds doesn't loads, blank (empty) window. have checked console sure there not javascript errors. i'm using function on background.js script chrome.app.runtime.onlaunched.addlistener(function() { chrome.app.window.create('index.html', { 'width': 1024, 'height': 768, }); }); it's strange because sound of app starts window remains empty. application made using sencha animator. something in index.html must causing error. try 1 of chrome-app-samples . try editing index.html trivial, , adding content until find error. check viewing errors in both background page , launched page. can right click app window , inspect element see it's inspector. can use chrome://extensions see inspector view pages.

java - Items not showing in TableView in JavaFX -

i have table view pintable in fxml and 2 table columns i.e. latcolumn, longcolumn. have followed following method populate table : https://docs.oracle.com/javafx/2/ui_controls/table-view.htm snippets follows: fxml controller class: @fxml public tableview pintable; @fxml public tablecolumn latcolumn, longcolumn; public final observablelist<pinlist> datasource = new fxmlcollections.observablearraylist(); @override public void initialize(url url, resourcebundle rb) { inittable(); } private void inittable() { latcolumn.setcellvaluefactory(new propertyvaluefactory<pinlist,string>("latpin")); longcolumn.setcellvaluefactory(new propertyvaluefactory<pinlist,string>("longpin")); pintable.setitems(datasource); } @fxml private void addbuttonclicked(mouseevent event) { if(lattext.gettext().equals("")) { system.out.println("lat empty"); } else if(longtext.gettext().equals("...

java - Trying to figure out why my graphics program is not working -

Image
i cannot figure out why graphics program's render function not displaying rectangle. also, if change bufferstrategy '3' funky behavior. currently, project has 2 main classes on called main , second called universaljframe . universaljfame class should called display, @ least can think of being display. please keep in mind still new java programming. public class main extends canvas implements runnable{ public int w = 200; public int h = 200; public string t = "hello"; private boolean running = false; private universaljframe frame; private thread thread; private bufferstrategy bs; private graphics g; private pausetest pause; public void run(){ system.out.println("run method"); while(running){ render(); tick(); pause.pause(); } stop(); } public synchronized void start(){ if(running) { return; } system.out.pri...

python tkinter creating new lines from sql -

hey i've got problem cant seem find solution for, i'm trying data sql database i've managed fine here problem prints on 1 line , goes off screen, if knows solution huge thanks, reference i've added bit need rest of necessary code in program. cursor.execute("select * staff") fetched_duties = cursor.fetchall() self.label_2 = label(self, text="%s" % fetched_duties) the tkinter label object doesn't perform text wrapping, if representation of list returned cursor.fetchall() long will, have seen, drop off right-hand side of whatever window appears in. try like self.label_2 = label(self, text="%s" % "\n".join(fetched_duties)) and see whether multiple lines.

code generation - What is the best way to auto-generate INSERT statements for a SQL Server table? -

we writing new application, , while testing, need bunch of dummy data. i've added data using ms access dump excel files relevant tables. every often, want "refresh" relevant tables, means dropping them all, re-creating them, , running saved ms access append query. the first part (dropping & re-creating) easy sql script, last part makes me cringe. want single setup script has bunch of inserts regenerate dummy data. i have data in tables now. best way automatically generate big list of insert statements dataset? i'm thinking of in toad (for oracle) can right-click on grid , click save as->insert statements, , dump big sql script wherever want. the way can think of doing save table excel sheet , write excel formula create insert every row, surely not best way. i'm using 2008 management studio connect sql server 2005 database. microsoft should advertise functionality of ssms 2008. feature looking built generate script utility, funct...

center - Centering multiple input elements with equal space in CSS -

i've got radio buttons text. how can center stuff, first button same 'margin-left' 'margin-right' of last letter of p of last input? html <div class='someclass'> <input type='radio' name='somename'>example <input type='radio' name='somename'>other text </div> css .someclass{ width:400px} .someclass input{ float:left} you may use display: inline-block elements put theme in line, still keep wide box model properties margin, padding, etc them: .someclass{ text-align: center; } .someclass .inputs{ display: inline-block; } <div class='someclass'> <p class="inputs"><input type='radio' name='somename'>example</p> <p class="inputs"><input type='radio' name='somename'>other text</p> </div>

jasper reports - How do I make a dynamic image in iReport? -

i have image in report. in image expression, want this: if ($f{num} >= 10) { "c:\\users\\zoudi\\workspace\\bfms\\red.jpg" } else if ($f{num} > 0) { "c:\\users\\zoudi\\workspace\\bfms\\red.jpg" } else {} obviously, syntax not correct. correct way go creating dynamic image this? thanks! if you're using groovy, try: ($f{num} >= 10) ? "c:\\users\\zoudi\\workspace\\bfms\\red.jpg" : ($f{num} > 0) ? "c:\\users\\zoudi\\workspace\\bfms\\blue.jpg" : "c:\\users\\zoudi\\workspace\\bfms\\yellow.jpg"

html - how to accomplish this border effect in css? -

Image
fiddle: https://jsfiddle.net/aronlilland/bsml1kx7/ for many moons have been trying find out how make following border effect around elements in css, borders between each line item "signature serveice". "facebook monitor" etc. can acheive spacing div row 1px appart 1 below it? or how best accomplish this? me seems there light color edge border around each shape, simple question, simple answer thank you! .table { background: #1e2129; width: 375px; } .row1 { width: 100%; line-height: 100px; background: #272a34; margin-bottom: 1px; text-align: center; color: #fff; font-family: helvetica; } .row2 { width: 100%; line-height: 100px; background: #313641; margin-bottom: 1px; text-align: center; color: #fff; font-family: helvetica; } looks me have lighter border @ top , darker border @ bottom. nothing fancy. didn't match colors exac...

CSS slideshow - How can I add a link to the image? -

how can add link these images. i've tried many variations of slideshows find when add links starts not displaying every other image. in code below have links commented out. if remove links images display fine. i have repeated images twice trying debug , have _parent tag in link because page displayed in iframe. your appreciated. thank time reading post. html <div class="slider"> <a href="" target="_parent"><img class='photo' src="featuredproducts/on-semi-python-sensors-sm.png"/></a> </div> css .slider { margin: 0; width: 180px; height: 1504px; overflow: hidden; position: relative; } .photo { position: absolute; -webkit-animation: round 16s infinite; opacity: 0; width: 100%; } @-webkit-keyframes round { 25% { opacity: 1; } 40% { opacity: 0; } } .slider img:nth-child(4) { -webkit-animation-delay: 12s; -moz-anima...

django - How to customize or replace OAuth2 login screen in Fiware IdM Keyrock -

we have login flow starting smartphone. login, registration , authorization screens provided keyrock / horizon not mobile friendly. want change layout accomodate smaller screens , change logo. how can customize or replace login, registration , authorization screens? horizon seems written in python/django. new django , ideally want change bunch of html templates somewhere. possible? or need django expertise accomplish this? want changes not overridden (or @ least require minimal work re-apply them) if update keyrock software newer version later on. we hosting our own keyrock idm once satisfied need to, testing fiware labs keyrock instance. the github sources https://github.com/ging/horizon/tree/master/horizon/templates/horizon , documentation not forthcoming on subject. pointers appreciated. first of all, right in screens not mobile friendly. i'll add backlog fix in upcoming releases fiware lab instance more mobile friendly. secondly, if want modify screens in ...

javascript - jQuery replacewith varibles not getting replaced on change -

on dropdown change variable val not getting changed in replacewith. still set initial value not getting updated. alert(val) give correct value. delete val not either. $(document).ready(function() { $("#answerdropdown").change(function() { var val = $(this).val(); if (val != '') { $("#filler").replacewith('<div id="replaced"> ' + val + '</div>'); alert(val); delete val; } }); }); fiddle the problem after first change replacing div id='filler' therefore 2nd , subsequent onchange there not element id='filler' - code doesn't run you can instead $("#filler").html('<div id="replaced"> ' + val + '</div>'); this result in filler div having inner div or $("#filler").replacewith('<div id="filler"> ' + val + '</div>'); which identical to...

c++ - Why do large amounts of libcurl connections lock up my windows system? -

i've made simple app creates libcurl object , starts sending http messages. point them @ box on local network running netcat server. start 200 of these on windows machine. netcat server responds many of requests, though many going on misses majority of them due timeout. you can find full source here , actual code being here . if poke around in there can see how build , run test app. within few minutes system become unresponsive. forced hit power button access again. not respond telnet, remote debugging, rdp, though respond pings. not create crash dump. the real problem here don't understand how catch while happening, don't know how debug it. i'm hoping knows correct way diagnose this. i can avoid implementing qos type behavior. unless can measure locking system, i'm afraid i'll masking issue. if start processes /belownormal seems reproduce faster. i unable reproduce on same machine when in safe mode. unable reproduce on mac. i've d...

c# - Unable to click element XPath -

this element i'm trying reach: <div class="ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"> <div class="ui-dialog-buttonset"> <button style="background-color: rgb(218, 218, 218);" aria-disabled="false" role="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" type="button"> <span style="background-color: transparent;" class="ui-button-text">ok</span> </button> </div> </div> this code i'm using: driver.findelement(by.xpath("xpath=(//span[contains(@class,'ui-button-text')][contains(text(),'ok')]))")).click(); i used find element feature of selenium ide using xpath , can find element. you don't need xpath= part inside expression: driver.findelement(by.xpath("//span[contains(@class,'ui-button-text')][contains(text()...

python 2.7 - wxPython GUI-wide settings -

i have both fundamental , technical wxpython question regarding gui settings common to, , accessed by, many aspects of single gui. in interest of saving time haven't cut/paste huge swathes of example code explain in words. don't think lose clarity doing shout if do. i have wxpython gui main feature notebook featuring many pages, majority of data plots. each page defined according unique class , while each class different, access same underlying data , therefore fundamentally connected. given connection, there settings within gui common pages within notebook. example, definition of colour or shape of points on various plots. such settings may used define how data displayed e.g. car data may red squares while bus data may blue triangles. given plots on each notebook page defined in separate classes, repeat these definitions in each class. however, feels code duplication , since colour/symbol definitions should common across plots, feels these definitions should @ top gu...

javascript - How to prevent overwriting context this in ES6 -

this question has answer here: how access correct `this` inside callback? 5 answers very similar how prevent jquery override "this" in es6. this class: class feedbackform { constructor(formel) { this.$form = $(formel) this.$form.submit(this.sendstuff) this.alerts = $('#something'); } /** * sends feedback * @param {event} e */ sendstuff(e) { e.preventdefault() if (this.alerts.length) { window.alert('notice... stuff') } $.ajax({ type: this.$form.prop('method'), url: this.$form.prop('action'), data: this.$form.serialize() }).done(() => window.location.reload(true)) } } the sendstuff method event handler of form, , jquery calls using function.prototype.apply believe. therefore, this inside sendstuff overwritten event target jquery applies...

g++ - Can't execute compiled C++ exe file -

i having trouble executing c++ code. have written basic "hello world" program, , compiled using g++ make command. here code: #include <iostream> using namespace std; int main() { cout << "hello world" << endl; return 0; } i on windows 10, using emacs code editing, , cygwin compilation. saved file hello.cpp. navigated directory in cygwin. did command make hello . created hello.exe. then, attempted execute file using ./hello.exe . tried ./hello didn't work. when type 1 of these commands , hit enter, on next line, not doing anything. can type in blank line, won't anything. know way make code execute properly. thank you. edit: tried running @ cpp.sh, online c++ compiler, , worked fine. your program working console window closing before can see anything. try adding input @ end of program wait. i.e. int a; cin >> a;

css - Target the first element only if it has other siblings -

without adding classes (or touching html) there way target first element inside div if there second element in div? below html: <div class="grid"> <div class="content">i want apply css this</div> <div class="content">but if there 2nd .content element in same parent element</div> </div> <div class="grid"> <div class="content">don't apply here</div> </div> <div class="grid"> <div class="content">don't apply here</div> </div> <div class="grid"> <div class="content">i want apply css this</div> <div class="content">but if there 2nd .content element in same parent element</div> </div> a few context better picture ... want center .content if it's .content inside .grid . if there 2 .content divs, want them float next each other. n...

node.js - Restricting access to documents to facebook friends in mongodb -

i'm building simple photo storage app has 3 resources using mongodb mongoose: users albums photos all authentication handled passportjs. a user can have many albums , album can have many photos using parent references . the albums each have different privacy setting: private - create can see it public - can see it friends - people (facebook) friends can see it when make query many albums want see mixture of 3 based on user logged in question how should check if user logged in facebook friend creator? facebook provides endpoint check if 2 users friends mean iterating through collection , making request on each , filtering results , returning them, me, seems lot of leg work. another approach (still without flaws): user signs , allows app friends using app store these friends _id in array on user when user creates album, save copy of array onto field on album query using $in operator using logged in users id pros: list item quickly check if us...

cakephp - An error "Class 'HttpSocket' Not Found" occured -

i'm trying update cakephp ver.1.3 2.6. and found error using mylibraryclass. error is: "class 'httpsocket' not found" and code is: <?php class myapiclient { public function __construct() { $this->socket = new httpsocket(); so added line before class. <?php app::uses('httpsocket', 'network/http'); class myapiclient { but error still shown. there did deal case? as per our discussion in comments have added following code in app/lib app::uses('httpsocket', 'network/http'); so please place same in required controller before class definition.

javascript - Bootstrap video jumbotron -

i'm trying video cover bootstrap jumbotron no success. seems simple thing do, try seems fail. i've tried solution posted here no success. i've tried setting position of video absolute, , setting sides 0, doesn't seem work either. doing wrong? this shows going on: https://jsfiddle.net/kae4q601/ .jumbotron{ position: relative; /* tried setting height. didnt work either */ /* height: 200px; */ } #video-background { position: absolute; bottom: 50%; right: 50%; -webkit-transform: translatex(-50%) translatey(-50%); transform: translatex(-50%) translatey(-50%); min-width: 100%; min-height: 100%; width: auto; height: auto; z-index: -1000; overflow: hidden; } <script src="//code.jquery.com/jquery-1.11.3.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <link href="https://maxcdn.bootstrapcdn.co...

.net - Compiling dynamic code at runtime using T4 and C# -

the articles have read on t4 using texttemplatingfilepreprocessor show how dynamically generate code becomes part of project, , compiled project. is possible use t4 generate code compiled @ runtime, outputted dll, , loaded , executed, said code having access usual visibility capabilities associated dll? if so, please point me example. i'm trying same thing generating dynamic dll using il, rather using c#. edit the specific case need straightforward. writing message router routes messages services. services may local or remote. declarative script compiled c#. dynamic part "is service local or remote?". output c# changed accordingly. style of routing different local / remote, hence dynamic nature. this 1 example of need. to this, need know 2 things: you can use run-time t4 template generate text @ runtime, including c# source code. you can use csharpcodeprovider compile assembly text @ runtime. or manually run csc.exe (the command-line c# compi...

jquery - How do I submit from values using AJAX in such a way that what is passed to the Servlet is a JSON string? -

so function: function buttonclicked() { $("#mybutton").click(function() { var field1 = $("#textinput1").val(); var field2 = $("#textinput2").val(); $.ajax({ url:"servvvvlet", method: "post", data: { // values forms in data string }, success: function() { // success code }, }); }); } how submit form values in such way submitted json string? by "json string", string json in it? function buttonclicked() { $("#mybutton").click(function() { var field1 = $("#textinput1").val(); var field2 = $("#textinput2").val(); $.ajax({ url:"servvvvlet", method: "post", data: json.stringify({foo: 'bar'}), // {"foo":"bar"} success: function() { // success code }, ...

Android: service 'not yet bound' but onBind() is called? -

i trying make button change interruption filter (none, priority, all) in android lollipop. when press button, log says w/notificationlistenerservice[notificationservice]: notification listener service not yet bound. , not change interruption filter. "nls started" , "nls bound" logs. why giving me warning? here code: mainactivity.java : public class mainactivity extends activity { private notificationservice notifs; private serviceconnection connection; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); notifs = new notificationservice(); connection = new serviceconnection() { @override public void onserviceconnected(componentname name, ibinder service) { log.d("notif", "nls started"); notificationservice.servicebinder binder = (notificationservi...

javascript - How to apply form onSubmit on one submit type only? -

i have html form on submit calls validation method. now, in form have 2 submit types: <input type="submit" name="abc" value="abc" > <input type="submit" name="xyz" value="xyz" > now, when click on submit button validation method called. want call validation method when 'abc' button clicked , not when 'xyz' clicked. is there way using javascript handle this? if want validate form on 1 submit button on form submit $('form').submit(function(event) { var btn = event.originalevent.explicitoriginaltarget.value; if (btn === 'abc') { alert('true'); } else { alert('false'); } }); demo - fiddle

ruby - Map array, iterate nested array -

please refer following code: x = 3 arr = ("a".."z").to_a arr2 = [1, 2, arr[ ], 4] arr3 = arr2.map * x desired output: arr3 # => 12a412b412c4 what best practice achieve output? ("a"..."z").first(3).map{|chr| [1, 2, chr, 4]}.join # => "12a412b412c4"

javaScript window.crypto.getRandomvalues is not working in safari browser -

can please me resolve issue. have used javascript window.crypto.getrandomvalues function working in browser expect safari web browser , safari browser version 5.1.7. please find code if ("crypto" in window && "getrandomvalues" in crypto) rand = crypto.getrandomvalues(new uint8array(1))[0] % 16|0; else rand = math.random() * 16 | 0; return hexs[i === 19 ? rand & 0x3 | 0x8 : rand]; }) please find screenshot. error: [screenshot][1] http://i.stack.imgur.com/z1ayk.png based on documentation here : the array given parameter filled random numbers. which not mean returns array filled random numbers. so, change code this: if ("crypto" in window && "getrandomvalues" in crypto){ var arr = new uint8array(1); crypto.getrandomvalues(arr) rand = arr[0] % 16|0; }

php - Is there any way to check .PEM file is Valid or not in iOS? -

Image
i have created production adhoc .pem files. have followed steps: by using this link created .pem file , checked valid or not using following command like: $php simplepush.php but getting error like:: warning: stream_socket_client(): php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known in /users/mac-jarc/desktop/simplepush/simplepush.php on line 21 warning: stream_socket_client(): unable connect ssl://gateway.sandbox.push.apple.com:2195 (php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known) in /users/mac-jarc/desktop/simplepush/simplepush.php on line 21 failed connect: 0 php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known but in php developer said it's .pem file mistake . tought it's not(because sure .pem file perfect) , suggested him it's server ports issue can please me out regarding this:: how check .pem file valid or not. here php code: ...

powershell - Rename files to match filenames in another folder -

i have 2 directories. d:\test\get\f d:\test\set\f inside get folder , set folders there equal amount of files. files in set same (it's common image file duplicated multiple times match number of files in set folder). my question is, how rename files in set folder same in get folder? e.g.: before get folder apple.jpg mango.jpg lychee.jpg set folder 123.jpg 12!.jpg asdasd.jpg after get folder apple.jpg mango.jpg lychee.jpg set folder apple.jpg mango.jpg lychee.jpg a simple example unoptimised , assumes best case. shows basic steps of iterating through files in path, getting file names , renaming files. $names = @() $getpath = "c:\temp\get" $setpath = "c:\temp\set" get-childitem $getpath | foreach-object{ $names += $_ } $i = 0 get-childitem $setpath | foreach-object{ rename-item -path $_.fullname -newname $names[$i] $i++ }

ruby,Get a datetime from sqlite3,always presents 2000-01-01 -

i want value of "start_time" "activities"(a table name in sqlite3) using ruby on rails. , meet problems. in sqlite3, value of "start_time" "2016-01-04 08:00:00", , it's correct value. but when got value using ruby , value "2000-01-01 08:00:00 utc". @activities = activity.all() @activities.each |activity| puts activity.start_date thanks in advance! you can use strftime("%y-%m-%d %h:%m") method remove utc . @activities = activity.all() @activities.each |activity| puts activity.start_date.strftime("%y-%m-%d %h:%m") if want set local time_zone instead of utc set config/application.rb file config.time_zone = '<your time zone>' for getting local time_zone please click here .

html - CSS display block and hide another on low resolution -

i'm trying hide navigation bar , display thing in place when resolution low , small screens (mobile) i did manage hide navigation bar the other thing won't display. @media screen , (max-device-width: 500px) { .small-menu { display: block; } .regular-menu { display: none; } } @media screen , (max-width: 1279px) { .small-menu { display: block; } .regular-menu { display: none; } } .small-menu { display: none; } .regular-menu { display: block; } write css seqvence write hole page css write css max-width 1279 write css max-device-width 500 .small-menu { display: none; } .regular-menu { display: block; } @media screen , (max-width: 1279px) { .small-menu { display: block; } .regular-menu...

php - Object not found! The requested URL was not found on this server -

i trying create page displays records of mysql table namely fares in tabular form . it's showing following message in browser object not found! the requested url not found on server. link on referring page seems wrong or outdated. please inform author of page error. if think server error, please contact webmaster. error 404 localhost apache/2.4.17 (win32) openssl/1.0.2d php/5.5.30 and here code: <?php include("dbcon.php"); if(isset($_post['view'])) { $vquery = mysql_query("select * fares order sno asc"); echo "<table border='1'>"; while($row = mysql_fetch_array($vquery)){ echo "<tr>"; echo "<td>".$row['sno']."</td>"; echo "<td>".$row['destination']."</td>"; echo "<td>".$row['distance']."</td>"; echo "<td...

android - Display show search view as extended by default -

i have implemented search view in actionbar. right scenario that, default search icon visible , when click on it, extending text. want show extended default when activity open, don't want open search icon. should do? sorry poor english. here menu.xml <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/action_search" android:icon="@android:drawable/ic_menu_search" android:title="@string/search" app:actionviewclass="android.support.v7.widget.searchview" android:imeoptions="actionsearch|flagnoextractui" app:showasaction="always" /> <item android:id="@+id/action_settings" android:title="@string/settings" app:showasaction="never" /> </menu> ============================== a...

html - Javascript to change the text color -

i have html table displays value below: <table id="tableid"> <thead> <tr> <th>column heading 1</th> <th>column heading 2</th> <th>column heading 3</th> <th>column heading 4</th> </tr> </thead> <tbody> <tr> <td> id (43.1)</td> <td>class (-23)</td> <td>age (89.6)</td> <td>num (-5)</td> </tr> <tr> <td>id (-4)</td> <td>class (-3)</td> <td>age (0)</td> <td>num (98)</td> </tr> <tr> <td>id (10)</td> <td>class (-32)</td> <td>age (7)</td> <td>num (2)</td> </tr> task @ hand change text color on condition basis. if value negative, should displayed in red, else green. have no idea how change this, till i'm able create below javascript code, not sure how handle text color , event shou...

iis - Url rewriting in classic asp -

how can rewrite home/search.asp?search=biscuits home/?q=biscuits i used format,but not able pass ?in url <configuration> <system.webserver> <rewrite> <rules> <rule name="search"> <match url="^([_0-9a-z-]+)/?$" /> <action type="rewrite" url="search.asp?search={r:1}" /> </rule> </rules> </rewrite> </system.webserver> </configuration>

jquery ajax element.children.length not getting updated -

we making ajax call every 5 seconds intent of appending content existing parent element. parent element has max of 25 elements above removed beginning of parent element. works expected except console.log call make output contentlength. contentlength keeps increasing in size , yet should @ 25. assume has fact making ajax call , dom length "incorrect" @ point inside ajax call. doing wrong? how can around this? ajs.$.ajax({ url: "ajax.action?", success: function (data) { //cleanup , insert parent div var divid = "#" + insertcontentintodiv; var wrapped = ajs.$("<div>" + data + "</div>"); ajs.$(wrapped).find('title').remove().end(); wrapped = ajs.$(wrapped).find('meta').remove().end(); ajs.$(divid + " dt:last-child").after(wrapped.html().trim()); /...

javascript - Push array to a collection of arrays -

i'm trying push array collection of arrays i'm getting unexpected results. var itemx = ['a','b','c']; var itemy = ['x', 'y', 'z']; var itemlist = []; itemlist.push(itemx); itemlist.push(itemy); i'm expecting this: itemlist = [ ['a', 'b', 'c'], ['x', 'y', 'z'] ] but instead i'm getting this: itemlist = ['a', 'b', 'c', 'x', 'y', 'z'] am missing here? appreciated. thank much. i think working fine, probable reason might trying alert itemlist; alerts a,b,c,x,y,z . var itemx = ['a','b','c']; var itemy = ['x', 'y', 'z']; var itemlist = []; itemlist.push(itemx); itemlist.push(itemy); alert(json.stringify(itemlist));

java - Get value of from data object -

how value of single element data object contains row of table in java? integer str = 100; criteria cr = new criteria(new column("tablename","column_name"),str,queryconstants.equal); dataobject dobj = per.get("tablename",cr); here, dobj contains single row have value of single column.

Typescript variables/fields are always undefined when debugging in VS 2013 -

why properties/field variables in typescript undefined when debugging in visual studio 2013? you debugging inside of arrow function, this becomes _this in runtime. so, use _this.myproperty in watch... read more arrow functions here

ruby on rails 4 - How to order in nested form -

the code below working on edit, display details according order. when try add new detail, submit it, , validation occurs, can't see newly added detail. tried remove ordering , shows detail. code : <%= simple_form_for @master_template, :html=> { class: "form-horizontal style-form" } |f| %> <%= f.simple_fields_for :master_template_details, f.object.master_template_details.order("name desc"), :wrapper => false |p| %> <%= render 'master_template_detail_fields', {f: p} %> <% end %> <% end %> i tried this: #model scope :ordered, -> { order("name desc") } belongs_to :master_template #view <%= simple_form_for @master_template, :html=> { class: "form-horizontal style-form" } |f| %> <%= f.simple_fields_for :master_template_details, f.object.master_template_details.ordered, :wrapper => false |p| %> <%= render 'master_template_detail_fields...

sql - How to work with Table joins and Inline View -

can me understand sql query; don't understand concept behind it: select t2.*, ( select sum (salary) ( select tb1.*, rownum rnk ( select * employees e order e.department_id, e.employee_id ) tb1 ) tb2 tb2.department_id = t2.department_id , tb2.rnk <= t2.rnk ) dept_salary ( select t1.*, rownum rnk ( select e.employee_id, e.first_name, e.department_id, e.salary employees e order e.department_id, e.employee_id ) t1 ) t2 there different type of subquery. scalar sub query : query totally independent main query. select empno, (select count(*) emp) total_emp emp here subquery totally independent of main query. corelated sub query: sub query reffers main query. select empno, (select ...

ruby on rails - I am getting the "no such file to load — openssl" error on OSX 10.7.5 -

i getting no such file load — openssl error on osx 10.7.5 in ruby on rails environment. i read related questions here on stackoverflow, nothing worked me. tried following: tried building openssl specified. did not work: rvm pkg install openssl rvm reinstall 1.9.2 --with-openssl-dir=$rvm_path/usr also tried system's openssl. didn't work, too: which openssl /opt/local/bin/openssl rvm reinstall 1.9.2 --with-openssl-dir=/opt/local/bin 3.read libyaml required. i've have it: brew install libyaml libyaml-0.1.4 installed other info : system has ruby version 1.8.7. works (including load ssl) when use ruby. old of gems using. so, have installed other versions using rvm. have made necessary environment changes. tried these steps 1.9.2, 1.9.3 both. same no such file load - openssl error . what missing? i had issues similar when installing ruby 2.0.0. had do: rvm head rvm pkg remove rvm requirements run rvm reinstall 2.0.0 (or 1.9.3 in case...

ruby on rails - `require': cannot load such file -- bundler/setup (LoadError) -

i getting started ruby on rails, facing lot of issues setting new blog ruby tutorials. i had installed ruby 2.3.0 using rubyenv on mac el capitan. after ran namespace conflicts , errors. solved them 1 one when run bin/rails generate controller welcome index on new blog, - /library/ruby/site/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- bundler/setup (loaderror) why show 2.0.0 when i've installed 2.3.0? stuff i've tried: $ sudo gem update --system $ export path="$home/.rbenv/shims:$path" $ echo $gem_home <returns blank> $which -a ruby /users/shubhamkanodia/.rbenv/shims/ruby /usr/bin/ruby rbenv versions system * 2.3.0 (set /users/shubhamkanodia/.rbenv/version) maybe fix bundle exec rake rails:update:bin

Remove a row in a GWT Datagrid without scrolling to the top of the grid -

i have datagrid may display many rows per page. let's displayed 25 rows per page. viewable area of grid, however, 10 rows. i.e. there 400px entire grid , each row 40px. there scroll bar on grid. when remove single row in grid, grid automatically moves first row in grid. if have scrolled bottom , deleted last row, once again moved 1st row. i have attempted several ways of combatting this, can't find solution works way want to. i've tried scrolling row directly before or after deleted row view using scrollintoview() method. i've tried figuring out how determine rows in visible range before deletion, getvisiblerange() method relevant page range, not actual displayed range. i've searched web , seems i'm 1 having problem. missing? i had same issue, found bug happend if datagrid has keyboardselectionpolicy="bound_to_selection"

Create java class not collectable by GC -

i want create class: - have 1 instance - accesible during lifetime of app. - class not have destroyed garbage collector. can achive using static, or singleton pattern? thanks the way ensure class cannot garbage collected ensure remains reachable. could: refer in class reachable, load in initial classloader (which reachable), put instance of class variable remains reachable, etcetera. in practice, unless class dynamically loaded using classloader created yourself, unlikely class unloaded / destroyed gc. on other hand ... if concerned singleton instance (not class ) being garbage collected, normal implementation of singleton design pattern takes care of that: public class mysingleton { private static integer instance = new integer(42); public static integer getinstance() { return instance; } } the static variable reachable long mysingleton class remains reachable ... lifetime of application run; see above. a public static va...

html - Modal inside a dropdown list is not working -

i'm trying put link modal inside drop down list. link here works fine. <li><a href="#openmodal" id='rosterbtn'><span id=''class='playbuttons badge primary'><i class='fa fa-user-plus'></i></span>add players</a></li> but once put inside dropdown list here <li class = 'has-submenu'> <a href="#">roster</a> <ul class="submenu menu vertical"> <li><a href="#openmodal" id='rosterbtn'><span id=''class='playbuttons badge primary'><i class='fa fa-user-plus'></i></span>add players</a></li> </ul> </li> it stops working. i'm using foundation css framework. thanks input i have change html code #openmodal #addplayermodel <li><a href="#openmodal" id='rosterbtn'><...

Do I need to free C variables in Objective-C code (iOS 6 with ARC)? -

if implement following within iphone code: nsstring* soundpath = [[nsbundle mainbundle] pathforresource:soundfile oftype:@"wav"]; systemsoundid feedbacksound; audioservicescreatesystemsoundid((__bridge cfurlref) [nsurl fileurlwithpath:soundpath], &feedbacksound); audioservicesplaysystemsound(feedbacksound); do have free "feedbacksound" c code? leak? i'm using arc / ios 6. you should. correct method call is: audioservicesdisposesystemsoundid ( reference ). in general arc deals objective-c objects. when deal lower-level framework (core graphics, audioservices, etc.) many calls allocate memory "under hood" disposal responsible. on many occasions, have specific methods deallocation, have doing allocation.

java - Why do I get a Stackoverflow Error? -

i have little recursive algorithm should guess number. call method guessnumber , give number , lower value number , higher value number. if value higher middle of area of numbers makes same process new area of numbers. value lower makes same lower area of numbers. , if none of these cases true returns max value (it min value because they're same @ point). why gives stackoverflowerror? don't see why programm can't end. appreaciated. thank you. public class starter { /** * @param args command line arguments */ public static void main(string[] args) { starter s = new starter(); system.out.println(s.guessnumber(18, 1, 100)); } public int guessnumber(int num, int min, int max) { int middle = (max - (min - 1)) / 2; if (num > middle) { guessnumber(num, middle + 1, max); } else if (num < middle) { guessnumber(num, min, middle); } return max; } } now don't error anymore code: public int guessnumber(int num, int min,...