Posts

Showing posts from September, 2011

SAP HANA javascript deployment -

is possible program extensions using js , integrate sap hana system later? can use api information db, manipulate them , possibly save them db or external db accessed later well? thank , sorry not find on sap pages. if understood question correctly, xsjs can you. proven , tested. option odata more convenient way in case not need advanced logic.

cordova - PhoneGap Barcode Scanner Unresponsive on iOS -

i have few apps using ios barcode scanner plugin phonegap. have been working until 2 weeks ago, not longer responsive after initializing. has else had problem? what happening scanner opens, not read qr or barcode. view unresponsive; cannot cancel out of view or have way of getting main application. way exit scanner hit home button , manually kill app. i have built apps xcode 6.2 , 6.3 , tested on ios 8.2 , 8.3. is known issue? cannot find info. the problem solved updating plugin. there couple of changes in past month unaware of. update found here: https://github.com/phonegap/phonegap-plugin-barcodescanner

vba - Interactive Excel worksheet in PowerPoint -

Image
i'm wondering if there solution add interactive excel worksheet powerpoint slide. idea explain model without having move excel. table not have update or save, present current data. pasted in. it might like: you can embed excel object powerpoint slide , edit excel cells in powerpoint when designing slide, not when running presentation. an open excel file 1 alt - tab away. why make things more complicated need be.

osx - Package Quicklook plugins for Appstore -

i have bunch of quicklook plugins , make them available through appstore. of now, have experience ios store , not mac store. there kind of standard tutorial on how create package after appstore download unwraps , installs plugins right library/quicklook folder automatically? create appstore account osx (not ios). there no need install it. can store quick generator in application bundle (in myapp.app/contents/library/quicklook/ ). details in quick programming guide > installing

java - How does GridBagLayout functions such as gridwidth/height and gridx/y work to scale the size of the GUI? -

i introduced gridbaglayout substitute vanilla jpanel layout, having trouble working functions gridwidth/height , gridx/y. not sure how work in changing size of gui , positions of buttons. below code professor gave me use reference, , tried fiddling numbers results never turned out expected happen, , not sure why. edit 1: clarify, wondering how gridwidth, gridheight, gridx, , gridy functions work resize gui , position buttons' locations. import java.awt.*; import javax.swing.*; class bar1 { public static void main(string[] args) { jframe frame = new jframe(); jpanel panel = new jpanel(); panel.setlayout(new gridbaglayout()); gridbagconstraints c = new gridbagconstraints(); frame.setdefaultcloseoperation(jframe.exit_on_close); c.gridx=0; c.gridy=0; c.gridwidth=2; c.gridheight=1; c.weightx = 2; c.weighty = 1; c.fill = gridbagconstraints.both; jbutton b = new jbutton(&

jquery - Insert missing UL tag to LIs -

because menu being generated dynamically using cms , way php somehow coded, missing ul tag, question how can insert/add/append ul tag enclose lis using jquery. this rendered code cms <h3 class="italic orange">accounting packages</h3> <div class="sidebarmenu"> <li><a href="#">what it</a></li> <li><a href="#">how works</a></li> <li><a href="#">packages</a></li> </div> thanks & regards said you use jquery .wrapall() function: $('.sidebarmenu').children().wrapall('<ul></ul>'); jsfiddle

javascript - Position: absolute making the image take the whole page -

i got slider banner, works perfectly, need put posiiton:absolute put 1 div above another, , when it, ignore width , height designed img, , make img occupate whole screen. me ? html: <div class="row"> <div class="eight columns all"> <img src="img/slide_1.jpg" class="hide" id="img-slide"> <img src="img/slide_2.jpg" class="hide" id="img-slide"> <img src="img/slide_3.jpg" class="hide" id="img-slide"> <!--<p>>></p> --> </div> css: .all img{ margin:15px; height: 95%; width:95%; border-radius:5px; position:absolute; } .all img.show{ opacity:1; left: 0px; -webkit-transition:all 1.0s ease-in-out; -moz-transition:all 1.0s ease-in-out; -o-transition:all 1.0s ease-in-out; transition:all 1.0s ease-in-out; } .all img.hide{

javascript - Polyline issue at high zoom level in Virtual Earth V6.3 (Bing) map control -

i have app virtual earth v6.3 control, using pure javascript add polyline, shown in following sample code snippet embedded in single html5 web page: <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>ve map polyline</title> <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3"></script> <script type="text/javascript"> function mapload() { // load map var _map = new vemap('map'); _map.loadmap(); // center point in ny city var _center = new velatlong(40.75, -73.99); // zoom level _map.setcenterandzoom(_center, 14); // set map style _map.setmapstyle(vemapstyle.shaded); // polyline layer var _layerpolyline = new veshapelayer(); // sample polyline array o

c# - Issues with creating Web Socket server on different port? -

we on windows 2008 , need use web sockets. cannot move iis8 windows 8 or windows 2012 has native web sockets support built iis. so thinking using web sockets via third party web socket server. however, mentioned have use port other port 80 using our web server app. clearly using port may cause issues installations have open ports on network. so, options? can take web socket call on 80 , reroute handled websocket call? we not want move windows 8 or windows 2012.

android - Arduino - Converting byte array to string/char array -

i'm working on communication between devices using hid on usb cable. sending string utf-8 encoded android device, , receive , read on arduino leonardo. my problem unable received message other type. need human readable string comparison i'm sending variety of commands arduino. ide either has type mismatch problem regardless of how try convert received message. i've tried many different things post 1 example. i'm sure there missing that's keeping me getting this! int n; n = rawhid.recv(buffer, 0); // 0 timeout = not wait if (msuntilnextsend > 2000) { msuntilnextsend = msuntilnextsend - 2000; // string mystr = ""; // byte charbuff[10]; // // (int = 0; < 64; i++) // { // mystr.concat((char) buffer[i]); // } // // mystr.tochararray(charbuff, 10); char readin[64] = { ' ' }; readin = (char *)buffer; string mystring = string((char *)buffer); if (strcmp(readin, "

How to delete version into version control of Team Foundation Server 2013? -

i'm new user team foundation server , have problem, during develop desktop app, team member performed inestable version , update (realize check-in) version version control , moment when check-in code server merge code latest version , system failure. i decided delete unstable versions of control version, not find way perform this. i read this article in article explain how perform roll version , not me. you must rollback maintain history of change. if rollback checkin out same if had never checked code in.

matlab - Reading .mat file in C++ -

i trained model in matlab , model parameters saved in .mat file. want read parameters in c++. i have uploaded similar model here. i can open model.mat file using matopen , access field names. i'm not able access contents of array of structures. can me that. thank you. you take matio: www.github.com/tbeu/matio matio open-source c library reading , writing matlab mat files. library designed use programs/libraries not have access or not want rely on matlab's shared libraries. it supports matlab file versions, including (nested) structs , cells.

gulp - Bower package css not added to vendor.css -

i'm using yeoman generator ( https://github.com/swiip/generator-gulp-angular ) project. , have added couple of bower libraries, namely, videojs, ngdialog. the problem i'm experiencing css files included in these libraries aren't being packaged vendor.css file rest of packages are. know that generator uses wiredep, i'm afraid don't know enough find out went wrong. basically, when go view source, see there style includes underneath vendor.css style include, eg. <link rel="stylesheet" href="../bower_components/ngdialog/css/ngdialog.css"> also notice how included using "../". break if i'm in html file in directory other root. any pointers? thanks. john. basically don't have worry building process, gulpfile provided gulp-angular configured future including bower components. once run bower install your_component , sure run gulp build again in command line, include needed styles index.html. if k

swampy.TurtleWorld not working in python 3.4 -

i m learning python using thinkpython book, using python 3.4 , anaconda ide. part of need continue install module called swampy. installed using pip, worked well. importing module worked tkinter, can't use of functions in module. checked lib folder, swampy there , functions in swampy folder. can't figure out why not working. please need help. if question isn't clear enough please let me know. have included code tried run , error message each time try running it the code try run (page 29, chapter 4 of think python version python 3.4) import tkinter import swampy world = swampy.turtleworld bob = turtle() print(bob) wait_for_user() error message got traceback (most recent call last): file "<stdin>", line 1, in <module> file "c:\users\mbaka1\anaconda3\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 682, in runfile execfile(filename, namespace) file "c:\users\mbaka1\anaconda3\lib\site-packages\s

javascript - Bind AngularJS variables into inline script tag -

i have need add in items scope inline script need run on site. from have tried in demo doesn't possible use values scope in inline script tags. best way achieve this <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.1/angular.js"></script> <div ng-app="app"> <div ng-controller="mainctrl"> '{{aaa}}' <script>console.log('{{aaa}}');</script> </div> </div> <script> 'use strict'; var app = angular.module('app', []); app.controller('mainctrl', ['$scope', function ($scope) { $scope.aaa = 'bbb'; }]); </script> console returns '{{aaa}}' want return bbb <div id="idd" ng-controller="mainctrl"> '{{aaa}}' <button ng-click="$log.log(aaa)">log</button>

php - Global Traffic Director - On DO droplet with Ubuntu, LAMP and Nginx help needed -

i have been trying follow digital ocean following exemple: https://www.digitalocean.com/community/tutorials/how-to-use-nginx-as-a-global-traffic-director-on-debian-or-ubuntu having set droplet ubuntu , there lamp stack already. despite having configured on top of lamp stack nginx try use geoip database, when run test.php file has in following code: <?php if (getenv(http_x_forwarded_for)) { $sname = getenv(server_name); $sipaddress = getenv(server_addr); $pipaddress = getenv(http_x_forwarded_for); $ipaddress = getenv(remote_addr); echo "$sname server has address : $sipaddress"; echo "<br />\n"; echo "your proxy ip address : ".$pipaddress. " (via $ipaddress) " ; } else { $servername = getenv(server_name); $serveripaddress = getenv(server_addr); $ipaddress = getenv(remote_addr); echo "$servername server has address : $serveripadd

Prevent user of selecting same values on select html -

i have 2 selects same values eg: <select id="1"> <option value="volvo">volvo</option> <option value="saab">saab</option> <option value="mercedes">mercedes</option> <option value="audi">audi</option> </select> <select id="2"> <option value="volvo">volvo</option> <option value="saab">saab</option> <option value="mercedes">mercedes</option> <option value="audi">audi</option> </select> how can prevent user not choose same values on both boxes? i populating select values php database. edit: i arrived on this: jsfiddle but needs improvement when changing value selected. first of html , css not designed that. said that,maybe can hack css similar since <option> inside both <select> haven't relationship (child-paren

c++ - Using a 2D array in an equation -

recently i've been working on engine thrust calculates slope @ given values. i've gotten lot of code work, cant seem equation function working. person supposed list values based off specific points on graph , newton, , give time thats different , computer find value in between time given , slope calculation. of course thats not working , i'm lost @ point, i'm 100% sure loop wrong in function, i'm not sure equation wrong. basically program supposed this x y .19 14.5 .24 6.0 .40 4.4 enter time: .21 ((.21-.19)/.24-.19))*(6-14.5)+14.5=11.1 thrust @ time .21 11.1 source #include <iostream> #include <cstdlib> #include <cmath> #include <string> #include <iomanip> #include <fstream> using namespace std; const int grid_rows=50; const int grid_cols=2; double slope(double thrust[grid_rows][grid_cols],double time); // constant declarations const double pi = 3.1415926535; // radius/diameter of circle // main program

iron router - Meteor onRendered does not work with ironRouter -

my coffeescript template.shiftdatatable.onrendered ( -> app.datatables() $('#shift-list-table').datatable pagelength: 10, "order":[[0, "asc"]] $('.datatables_filter input').attr('placeholder', 'search') ) my jade template .table-responsive table#shift-list-table.table.table-vcenter.table-condensed.table-hover thead tr th shift code th shift type th shift start date tbody each shifts tr td {{code}} td {{type}} td {{formatdate createdat}} the problem when go page using ironrouter (router.go, pathfor), onrendered run before has been rendered. when happens me, use tracker.afterflush() : template.shiftdatatable.onrendered ( function () { tracker.afterflush ( function () { app.datatables() $('#shift-list-table').datatable pagelength: 10, "order":[[0, "asc"]]

java - Webservice request fails for sequential call in Webshpere 7.0 -

i running error when trying call web service server side of spring based web application. javax.xml.ws.webserviceexception: java.io.ioexception: async io operation failed (1), reason: rc: 55 specified network resource or device no longer available. the web application developing running on websphere 7.0 / windows server 2008 r2 64bit. the web service interface implemented javax.iws.webserivce (uses @webservice annotation). in case has 2 methods implemented @webmethod annotation call 2 different methods on web service. error happens when try call 1st , 2nd methods sequentially 1 after another. calling both of these methods done in same server side function: public myresponse getresponse (...) { res res1 = webserviceinstance.getfstcall() res res2 = webserviceinstance.getsndcall() } 1st method call succeeds, above mentioned error 2nd call.

javascript - jquery attribute select on click not working -

i have problem following: $(document).on("click", ".adm_vid_stcs_refresh_btn['data-ctg-id']", function(){ categories.ctgid = $(this).attr("data-ctg-id"); categories.ctgtype = $(this).attr("data-ctg-type"); categories.ajax(); }); when click button class .adm_vid_stcs_refresh_btn the following error: uncaught error: syntax error, unrecognised expression: ['data-ctg-id'] how can select class attribute jquery? when using attribute selector has attribute selector have used, attribute name should not not enclosed string literal in '' or "" ".adm_vid_stcs_refresh_btn[data-ctg-id]" so $(document).on("click", ".adm_vid_stcs_refresh_btn[data-ctg-id]", function () { categories.ctgid = $(this).attr("data-ctg-id"); categories.ctgtype = $(this).attr("data-ctg-type"); categories.ajax(); });

php - slim framework no output displayed -

i'm trying json file using slim framework. code i'm trying mentioned below $app->get('/forum/:id', function ($id) { $user_name = "abc"; $password = "123"; $database = "test"; $server = "localhost"; $db_handle = mysqli_connect($server, $user_name, $password); mysqli_set_charset($db_handle, "utf8"); mysqli_select_db($db_handle, $database); $arr = array(); $sql = "select y123_forum.post_id, y123_forum.posttext y123_forum inner join y123_users on y123_forum.user_id = y123_users.id type = 1 , y123_users.email = 'id'"; $result = mysqli_query($db_handle, $sql); while ($row = mysqli_fetch_assoc($result)) { array_push($arr, $row); } mysqli_close($db_handle); echo json_encode($arr); }); the output displayed on browser [] when try above code without passing parameter, i.e $app->get('/faqs/', function () { $user_name = "abc"; $password = "123";

nginx - Time Served shows 0.0us in goaccess tool -

we installed goaccess v0.9 in our linux machine. have customized log format in nginx. log_format timed_combined '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for" <msec=$msec|connection=$connection|connection_requests=$connection_requests|millis=$request_time>'; but while viewing logs using goaccess tool, time served parameter shows 0.00us panels. log format used in goaccess.conf log-format %h %^[%d:%^] "%r" %s %b "%r" "%u" %^ %d how display correct time served in goaccess report assuming log-format correct, nginx uses milliseconds, instead of specifying %d (microseconds), should use %t . log-format %h %^[%d:%^] "%r" %s %b "%r" "%u" %^ %t more custom log .

javascript - ng-pattern not working with regular expression -

my form has below inline validation <form name="coform" novalidate> <div> <label>transaction: </label> <input type="text" name="transaction" class="form-control" placeholder="<direction> <message type>, ex.:out x12214" ng-model="newco.transaction" ng-pattern=/(^(in )([a-za-z0-9 &_]+))|(^(out )([a-za-z0-9 &_]+))/ required> <span style="color:red" ng-show="coform.transaction.$dirty || coform.transaction.$invalid"> <span ng-show="coform.transaction.$error.pattern"> enter correct value transaction </span> <span ng-show="coform.transaction.$error.required"> transaction required. </span> </div> </form> but validation works required , not pattern here fiddle below

php - Sum of a field which stored as an array and group by the same id in laravel 4 -

i have field in table called "images" stored array, $new_item_photos = item::wherein('id', [10, 15, 10])->get(); foreach ($new_item_photos $new_photos) { if ($new_photos->id == $new_photos->id) { $total_photos += count($new_photos->images); } else { $total_photos = count($new_photos->images); } echo $total_photos."<br>"; } i result id photos 10 8 15 9 10 7 now want sum $total_photos , filter duplicate id loop, ex: id photos 10 15 15 9 can please me on this? ps: images saved in array format in table you can use array store count of photos each id. modified example helps further $new_photos = item::wherein('id', [10, 15, 10])->get(); $total_photos=[]; foreach ($new_photos_dealers $new_photos_dealer) { if ($new_photos->id == $new_photos->id) { if(array_key_exists($new_photos->id,$total_ph

C# - NullReferenceException while moving data from Excel to SQL Server -

i developing web application in have import data in sql server given excel files using c# , asp.net mvc. purpose followed this article. used exceldatareader read excel files. furthermore have used sqlbulkcopy in code insert data database. following code: the create method var bdata = getbilldata(); var connstring = configurationmanager.connectionstrings["wasabill"].connectionstring; datatable table = new datatable(); using (var reader = objectreader.create(bdata)) { table.load(reader); } using (sqlbulkcopy bcp = new sqlbulkcopy(connstring)) { bcp.columnmappings.add("accountno", "accountno"); bcp.columnmappings.add("billno", "billno"); bcp.columnmappings.add("category", "category"); bcp.columnmappings.add("billing_period", "billing_period"); bcp.columnmappings.add("name", "name");

bash - Grep Next Line and Modifying grep -

still stuck on one. i need use grep search first line (issn) , should able output 0007-9235 <td nowrap valign="top" align="right"><b>issn:</b></td> <td valign="top"> 0007-9235 </td> i had issued issn=$(grep "issn:" $i -a1) , out put is <td nowrap valign="top" align="right"><b>issn:</b></td> <td valign="top"> 0007-9235 </td> <td nowrap valign="top" align="right"><b>issn:</b></td> <td valign="top"> 0028-4793 </td> <td nowrap valign="top" align="right"><b>issn:</b></td> <td valign="top"> 0009-2665 </td> <td nowrap valign="top" align="right"><b>issn:</b></td> <td valign="top"> 0034-6861 </td> <td nowrap valign="top" align="rig

android - How to create button dynamically from one activity to another activity -

i creating android application consists of adding button dynamically.here when click button in 1 activity button dynamically created activity. possible create button when clicking button in 1 activity create button in activity.please me this. package com.example.dynamicbutton; import android.app.activity; import android.content.intent; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.button; public class mainactivity extends activity { button add_button; activity_2 act_child; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); add_button = (button)findviewbyid(r.id.button_add); add_button.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { intent invisible = new intent(mainactivity.this,activity_2.class);

iphone - iOS maximum video size can be uploaded to server -

i loading video file server through asihttprequest . maximum video size can uploaded server? there no limit forced using asihttprequest itself. wrapper around cfnetwork api. there other factors may affect, connection speed, amount of space in server etc.

plsql - LISTAGG IN PL/SQL -

help please find mistake in creating function return 1 row list. select listagg(' ' || v_receiving_list.document_number || chr(13)) within group (order v_receiving_list.document_number) svc.claim_detail, tbc.v_receiving_list claim_detail.id_claim = 334455 , v_receiving_list.id_receiving_list = claim_detail.id_receiving_list the code return correct result. but next dont return same. declare scodes varchar2 (4000); begin select (listagg(' ' || receiving_list.document_number || chr(13)) within group (order receiving_list.document_number)) scodes svc.claim_detail, tbc.v_receiving_list claim_detail.id_claim = 334455 , receiving_list.id_receiving_list = claim_detail.id_receiving_list; dbms_output.put_line(scodes); end; sql> select * v_receiving_list ; document_number id_receiving_list --------------- -------------------- 1 1 2

c++ - How does the attractive force of Fruchterman Reingold work with Boost Graph Library -

i learning fruchterman-reingold algorithm in boost graph library. reading document, know algorithm compute positions nodes in terms of graph layout, problem cannot understand calculation steps of attractive forces in boost graph library. for example, if topology rectangle height 100 , width 100, each vertex labelled string, , relation between each pair vertex as: "0" "5" "kevin" "martin" "ryan" "leo" "y" "s" "kevin" "s" "american" "usa" each row denotes 2 labelled vertices connected. formula of attractive force each vertex supposed be: f = (d^2) / k where d distance between 2 vertices , k optimal distances. don't understand how distance d in code of fruchterman-reingold in boost graph library. in example, compute ascii value difference between each pair vertices distance d ? (ascii value of '0' 48, , ascii value of '5' 53. true fr

c# - Parse HTML Code to get a JSON property out -

this question has answer here: what best way parse html in c#? [closed] 15 answers hi have following code c#.net asciiencoding encoding = new asciiencoding(); string postdata = "membershipcardnumber=" + cardnumber; postdata += ("&terminalname=" + terminalname); postdata += ("&serviceid=" + casinoid); byte[] data = encoding.getbytes(postdata); httpwebrequest myrequest = (httpwebrequest)webrequest.create("http://myurl"); myrequest.method = "post"; myrequest.contenttype = "application/x-www-form-urlencoded"; myrequest.contentlength = data.length; stream newstream = myrequest.getrequeststream(); newstream.write(data, 0, data.length); httpwebresponse response = (httpwebresponse)myrequest.getresponse(); // stream associated response. stream receivestream = response.getresponsestream(); // pipes strea

php - Avoid the header of box xpath and curl -

iam writting code web data xpath , curl. these code ul li contain , worked. but dont want header.. i write following code avoid header can't if($row->item(0)->tagname != '<ul class="graybg"><li>مدل خودرو</li> <li>مشخصات</li><li>قیمت نمایندگی</li><li>قیمت بازار آزاد</li></ul>') full code. $ch = curl_init ("http://www.pedal.ir/price/"); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch,curlopt_useragent,'mozilla/5.0 (windows; u; windows nt 5.1; en-us; rv:1.8.1.13) gecko/20080311 firefox/2.0.0.13'); curl_setopt($ch, curlopt_header, 0); curl_setopt($ch, curlopt_encoding, 'utf-8'); $page = curl_exec($ch); $dom = new domdocument('1.0', 'utf-8'); libxml_use_internal_errors(true); $dom->loadhtml($page); libxml_clear_errors(); $xpath = new domxpath($dom); $data = array(); $table_rows = $xpath- >query('/html/body/di

javascript - When is there ever an instance in which you can include multiple occurrences of the same element id in a single html document? -

to explain question further, i'll explain i'm trying achieve. ok, have contact.php page , have been adding @media styles page's referenced stylesheet. contact page has validation javascript running on append 'error' on end of input's id in order display error regarding input field. i have added hidden form within same fieldset remains hidden until screen size gets reduced width, form gets displayed while original 1 becomes hidden. with form though, of input id's have stayed same original, thought javascript errors still work same, not showing @ all. i know having multiple occurrences of same element id in 1 document big no-no, i've never done before, means i've never faced issues in regard. what i'd know answer is: having input id's occur twice in same document causing javascript errors not show after form displayed while original changed hidden? after reading question thing observed in suggession if call html element

PayPal Description Javascript -

Image
i creating app in appery.io , have implemented paypal restapi into. correctly running can not description/order summary correct.... have this var sreturn =''; sreturn +="recipient: "+ localstorage.getitem('giftcard_recipient'); sreturn +="recipient email: "+ localstorage.getitem('giftcard_email'); sreturn +="card type: "+ localstorage.getitem('giftcard_type'); sreturn +="card amount: "+ localstorage.getitem('nprice'); sreturn +="note: "+ localstorage.getitem('giftcard_note'); return sreturn; which in turn results in this.... i dont know how paypal order summary many see, such as... i don't know how works apps, on normal websites shopping carts need send couple of hidden fields paypal result want. of them required, optional. important probably: <input type="hidden" name="cmd" value="_cart" /> check out site more options: paypal

java - Unable to loop for different data -

i unable loop through database timelist output different time require. loop through first 1 , display same data every output require. if close loop of of conversion, have problem displaying in output statement. string[] timeminute = timelist .split("<split>"); (int t = 0; t <timeminute.length; t ++) { string strdate = timelist; simpledateformat sdf = new simpledateformat("yyyymmddhhmmss"); date getdate = sdf.parse(strdate); calendar calendar = calendar.getinstance(); calendar.settime(getdate); int noofhours = calendar.get(calendar.hour_of_day); int noofminutes = calendar.get(calendar.minute); int totalminutes = noofhours * 60 + noofminutes; while ( rs.next() ) { string rtd= rs.getstring("rtd"); if ( !trd1.contains( rtd) )

php - Use Eloquent scope on each eager loaded element in Laravel -

i have situation this. there authors , books . books belong authors , authors have many books . there table publish_year different years have primary keys cast against them. i.e. year 2005 has primary key 1, year 2006 has primary key 2 etc. now, on books table, year_id foreign key refers primary key of publish_year table. want eager load authors books specific year (which made active admin panel). i have developed following eloquent query. models author , book , publishyear . there additional where conditions performed on query . return author::with(['books' => function($query) { $query->where('year_id', '=', publishyear::where('is_active', '=', 1)->pluck('id')) ->where('is_available', '=', 't') ....; }])->get(); it works. there way use scope inside query this: return author::with(['books' => function($query) { $query->scope(); } so, can

c++ - BFS On a Bipartite graph; Shortest Path between two points -

Image
here's assumption i'm making, before started, tell me if wrong: representing bipartite graph (shown below): can nxm matrix n 1 side , m other , there's 1 @ index if connected, correct? anyways, i'm trying represent "erdos" number kind of thing, or "kevin bacon number" kind of thing, 1 side movies , other side actors. far have 2 vectors hold each movie , actor , adjacency matrix matrix of nodes (each nodes contains movie name, actor name, , adjacency boolean/number), 1 if actor in movie , 0 otherwise: i want figure out how many degrees of separation there between 2 actors (i.e. if actor in movie 1, actor b in movie 1 , 2, , actor c in movie 2, degrees between , c 2; 0 if same actor). my questions are, doing right far? how continue? know bfs uses queue can't seem right, or start on right path. compare? it's know can't seem think of @ all. have 2 functions give me index of requested actor in actors vector (and 1 movie), gi

c# - Allow underscore "_" as a special character -

this expression, not accepting "_" special character {(?=.{8,})(?=(.*\d){0,})(?=(.*\w){1,})} when set conditions inside pattern, not forget consume characters, add .+ capture 1 or more symbols, or .* capture 0 or more characters: {(?=.{8,})(?=(.*\d){0,})(?=(.*[^a-za-z0-9]){1,}).+} however, if want require string have @ least 1 digit , @ least 1 non-word symbol (excluding underscore), i'd suggest using {(?=.{8,})(?=(?:.*\d){0,})(?=(?:.*[^a-za-z0-9]){1,}).+} see demo .

sql server - PHP MSSQL PDO get table names? -

i want array of tables remote database using pdo ( mssql ) notice cannot use mysql query commands , any advice how tables information mssql database using pdo or mssql ? i able connect : try { $hostname = $myserver; $port = 10060; $dbname = $mydb ; $username = $myuser ; $pw = $mypass; $dbh = new pdo ("mssql:host=$hostname;dbname=$dbname","$username","$pw"); } catch (pdoexception $e) { echo "failed db handle: " . $e->getmessage() . "\n"; exit; } but not able data : $q = $dbh->prepare("describe"); $q->execute(); $table_fields = $q->fetchall(pdo::fetch_column); print_r($table_fields); } catch (pdoexception $e) { echo "failed db handle: " . $e->getmessage() . "\n"; exit; } user permissions using has read permission query against information_schema. select table_name, table_type information_schema.tables you can use colu

python - How to get all lines from one file which contain a string in another file? -

file 1: a b c d file 2: a a1 b b1 e e1 f f1 my desired output: a a1 a1 b b1 i trying implement using bash or python. in python tried: f1=open("file1") f2=open("file2") dpo1=f1.readlines() dpo2=f2.readlines() in dpo2: j in dpo1: if j in i: print in bash thinking of using grep grep give output matches entire line not case here. ideas? in awk will work if string matches field. awk 'fnr==nr{a[$1]++;next}{for(i=1;i<=nf;i++)if(a[$i]){print;next}}' file{1,2} a1 b b1 for edit awk 'fnr==nr{a[$1]++;next}{for(i=1;i<=nf;i++)if(a[$i]){for(j=1;j<=a[$i];j++)print;next}}' file{1,2} a1 a1 b b1

arrays - Reordering a vector in Matlab? -

i have vector in matlab b of dimension nx1 contains integers 1 n in order, e.g. n=6 b=(2;4;5;1;6;3) . i have vector a of dimension mx1 m>1 contains same integers in ascending order each 1 repeated arbitrary number of times, e.g. m=13 a=(1;1;1;2;3;3;3;4;5;5;5;5;6) . i want c of dimension mx1 in integers in a reordered following order in b . in example, c=(2;4;5;5;5;5;1;1;1;6;3;3;3) one approach ismember , sort - [~,idx] = ismember(a,b) [~,sorted_idx] = sort(idx) c = b(idx(sorted_idx)) if one-liners, bsxfun - c = b(nonzeros(bsxfun(@times,bsxfun(@eq,a,b.'),1:numel(b))))

javascript - How to Fade In Background on Page Load - jQuery -

when click on link gif image load on corner of page. need fade in entire background on page loading, have added $('#content').fadein(1000); show background in fade effect how can fade background page while gif loading on background ? html <div id="cssmenu"> <li><a href="index.html">html</a></li> <li><a href="about.html">about</a></li> <li><a href="portfolio.html">portfolio</a></li> </div> <div id="wrapper"> <div id="content"> <h2>welcome!</h2> <p> ajax functionality content loads relevant container instead of user having navigate page awesome effects...</p> </div></div> css #wrapper { border:1px solid green } #cssmenu { background: #333; list-style: none; width:120px; } #cssmenu li { margin: 0; padding: 0; list-style:

java - Load email using javax.mail -

i using java.mail jar file version 1.4.7 i created window's scheduler load emails email server. scheduler run every 7 minutes. @ end of code, emails loaded, system delete them email server. this supposes work if previous instance takes more 7 minutes load emails, new instance load same email because first instance have not run code delete email. i think concurrency issue. i have tried few solutions: add synchronized keyword method. add checkbox named isrun . before instance run method, need verify whether isrun == false . if false, system run method; if true, bypass of code. after instance finishes running method, update isrun checkbox false again. increase length of time of window's scheduler. run method every 15 minutes instead of 7 minutes. change method non-static static. these methods not workable if size of emails large. (possible have lot of attachments.) do have idea on how solve this? i presume windows scheduler event fires off new ins

Counting occurences of words that appear in a list using Python -

i have appended excel sheet values list using xlrd. called list a_master. have text file words want count occurrences of appear in list (i called file dictionary , theirs 1 word per line). here code: with open("dictionary.txt","r") f: line in f: print "count " + line + str((a_master).count(line)) for reason though, count comes 0 every count word exists in text file. if write out count 1 of these words myself: print str((a_master).count("server")) it counts occurrences no problem.i have tried print line in order see if seeing words in dictionary.txt file correctly , is. lines read file terminated newline character. there may white space @ end. better strip out whitespace before doing lookup with open("dictionary.txt","r") f: line in f: print "count " + line + str((a_master).count(line.strip())) note ideally, searching list linear , may not optimal in cases. think collec

ios - collectionView cells overlapping -

i trying create multiple collectionviewcells 4 different types. , every cell has different view of 1 of 4 types. every view of types can have different contents based on user selection. the problem having fact of cards overlapping/not loading correctly when multiple views/cells of same type on screen. -(uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath { card *card = [[[usermanager getselecteduser] getcards] objectatindex:indexpath.item]; nslog(@"card loading: %@", card.title); [card setuplayout]; uicollectionviewcell *cell; if(card.type.intvalue == 1){ cell = [collectionview dequeuereusablecellwithreuseidentifier:@"lifestylecell" forindexpath:indexpath]; }else if(card.type.intvalue == 2){ cell= [collectionview dequeuereusablecellwithreuseidentifier:@"scenecell" forindexpath:indexpath]; }else if(card.type.intvalue == 3){ cell =

css - Bootstrap 3 callouts missing in Yii 2 application -

i've added example code displaying bootstrap 3's callout yii2-powered application: <div class="bs-callout bs-callout-info"> <h4>use protocol</h4> avoid links without <code>http://www.</code> or <code>https://www.</code> in beginning. </div> and can't see proper styling. what missing. bootstrap on board yii2 old , doesn't have these styles? or maybe forgot push magic button somewhere? callouts used in docs, it's not included in main css . yii 2 ships newest version of bootstrap (at current moment 3.3.4 ), not reason. you have write proper css styles yourself. according this article need add this: .bs-callout { padding: 20px; margin: 20px 0; border: 1px solid #eee; border-left-width: 5px; border-radius: 3px; } .bs-callout h4 { margin-top: 0; margin-bottom: 5px; } .bs-callout p:last-child { margin-bottom: 0; } .bs-callout code { border-radius: 3

webmethods - How can i change the input or outputDoc name after the mapping was done? -

in webmethods designer have mapped of fields input doc (studentinfo) output doc (studentpersonalinfo). now requirement outputdoc name must changed studentpersonalinfo-->studentpersonalinfo2 . how can directly change output doc name reflect in respecive services new name. i tried change the doc name integrationserver\packages\<packagename>\ns\<foldername>\flow didn't work. as stated "raghava rudrakanth p v", it's not recommended manually modify flow.xml. however, recommended way, described "raghava" more tedious. if know doing, can open flow.xml file in text editor , replace occurrences of studentpersonalinfo studentpersonalinfo2 . note: wary document references if have qualified document names containing studentpersonalinfo . make sure reloaded package after made change flow.xml file gets reloaded memory webmethods engine. hope helps!

java - Read and write file with windows-1252 -

i'm trying write file containing german characters disk , read using windows-1252 encoding. don't understand why, output this: <title>w�hrend und im anschluss die exkursion stehen ihnen die ansprechpartner f�r o-t�ne</title> <p>die themen im �berblick</p> any thoughts? here code. you'll need spring-core , commons-io run it. private static void write(string filename, charset charset) throws ioexception { string html = "<html xmlns=\"http://www.w3.org/1999/xhtml\">" + "<head>" + "<meta http-equiv=\"content-type\" content=\"text/html; charset=windows-1252\">" + "<title>während und im anschluss die exkursion stehen ihnen die ansprechpartner für o-töne</title>" + "</head>" + "<body>" + "<

Excel VBA Timeout Error -2147012894 -

i trying make rest call sfdc excel vba (using oauth2) every time got error message "error : -2147012894 - timeout error" on "http1.send" line. below code working fine on machine. both machine have excel 2007 windows 7 code : dim http1 object dim url string url = "https://test.salesforce.com/services/data/v32.0/sobjects/opportunity/describe" on error goto errorhandler set http1 = createobject("msxml2.serverxmlhttp") http1.open "get", url, false http1.settimeouts 0, 0, 0, 0 http1.setrequestheader "authorization", "bearer " & getsetting("sf", "tokens", "accesskey") 'accesstoken http1.setrequestheader "content-type", "application/json" http1.send set retrievedata = http1 set http1 = nothing exit function errorhandler: msgbox "error : " & err.number & " - " & err.description please help, if have come across type of error.

php - Redirect wrong urls to 404 page -

how redirect wrong urls 404 page? for example, subdomain.domain.com fine, if users enter subdomain.domain.com/asadasd/ada or that, index page still shown. how make these mistyped urls show 404 page? im using php, mysql, cpanel ect ect. yes, using htaccess errordocument 404 /error.php no luck here. you can use '.htaccess' put line in .htaccess errordocument 404 /error.php , create error.php file in root folder.