Posts

Showing posts from 2012

java - Implement next and previous from database to form -

i have problem in implementing case. 1) examples show can use in following: try{ bd.conectarbasededatos(); preparedstatement stmt; string sql=("select * cab_pedido a, det_pedido b a.numero = b.numero , a.cod_agencia = b.cod_agencia"); system.out.println(sql); stmt = bd.conexion.preparestatement(sql,resultset.type_scroll_insensitive,resultset.concur_read_only); bd.result = stmt.executequery(sql); } catch (instantiationexception | illegalaccessexception | sqlexception e){ system.out.println(e);} return rs; } this returns resultset , can use rs.next(). rs.previous(), etc solve problem, see comments should close rs , db connection. how dangerous that? can implement without closing resultset , connection? because when close resultset, not able data anymore. 2) store data hashmap or list possibility if want last or first values how can that? i ...

javascript - Interim message when downloading a file -

on website have option display data , download in csv format. of data quite large (20,000 - 900,000 rows in sql). when display on site use paging displays x amount of rows @ time, however, download link of course should , downloading entire report can take several seconds couple of minutes depending on file size. i'm wondering if there way create interim pop-up or message in-line says "gathering information..." additionally put animated gif user knows happening. creating shouldn't issue i'm not sure if there way trigger disappear once download pop-up appears. solutions i've seen on site suggest using timer, thats not option in case times vary lot. i'm using classic asp use either or javascipt. additionally use flash if makes difference. i wire "gathering info..." message hidden upon receipt of comet style message server sent out file ready download on end.

python - Matplotlib: Making a line graph's datetime x axis labels look like Excel -

Image
i have simple pandas dataframe yearly values plotting line graph: import matplotlib.pyplot plt import pandas pd >>>df b 2010-01-01 9.7 9.0 2011-01-01 8.8 14.2 2012-01-01 8.4 7.6 2013-01-01 9.6 8.4 2014-01-01 8.2 5.5 the expected format x axis use no margins labels: fig = plt.figure(0) ax = fig.add_subplot(1, 1, 1) df.plot(ax = ax) but force values plot in middle of year range, done in excel: i have tried setting x axis margins: ax.margins(xmargin = 1) but can see no difference. if want move dates, try adding line @ end: ax.set_xlim(ax.get_xlim()[0] - 0.5, ax.get_xlim()[1] + 0.5) if need format dates either modify index or make changes in plotted ticks so: (presuming df.index datetime object) ax.set_xticklabels(df.index.to_series().apply(lambda x: x.strftime('%d/%m/%y'))) this format dates excel example. or change index want , call .plot() : df.index = df.index.to_series().apply(lambda x: x.strftime(...

android - Getting application context into fragment, ViewPager -

i'm writing simple app swipe view using viewpager , fullscreen fragments. in 1 of fragments want check internet connection status before displaying data can't application context. i've found lot of topics on issue, none of solutions works me. using getapplication() within fragment though error "unreacheable statement" . any advice? import android.support.v4.app.fragmentactivity; import android.support.v4.view.viewpager; import android.os.bundle; public class mainactivity extends fragmentactivity { viewpager viewpager; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); //setting fragment view pager viewpager = (viewpager)findviewbyid(r.id.pager); pageradapter pageradapter = new pageradapter(getsupportfragmentmanager()); viewpager.setadapter(pageradapter); } } activity_main.xml <android.support.v4.view.viewpager xmlns:android=...

mysql - Copy URL, Remove the '/' and '.php' and paste remaining in place of Column in Php for MySQLdb -

if site is: www.abc.com/efg.php then how can automatically paste efg in place of column name (which firstnamee in one) here coding: mysql_select_db("blahblah_abcdefgh") or die(mysql_error()); $data = mysql_query("select firstnamee qwerty") or die(mysql_error()); $result=mysql_result($data); echo $result; ?> thanks in advance one more thing efg existing column in db if site is: www.abc.com/efg.php then efg is $value = basename(__file__, '.php'); use please :) cause i'm not going add injection prone query :)

linux - Zip multiple directories into one zip file -

$ cat /home/myapp/properties.csv /document/source/ /downloads/lib/ /home/app/newfiles/ the above simple file holds directories i'm interested in... $ cat /home/myapp/zipup.sh #!/bin/bash folder="/home/myapp/properties.csv" cat $folder| while read dir; //zip directories read in how complete zipup.sh script directories , contents in each of directories defined in properties file included in single zip file i.e. result should this... /result.zip (everything goes in here) /source /hello.class /hello.jar /lib /xml.jar /newfiles /list.doc #!/bin/bash while read dir; dirs="$dirs $dir" done < /home/myapp/properties.csv zip -r result $dirs

angularjs - Angular JS Action on ng-change the select dropdown -

i have simple table 3 rows , 2 values each row - date , state: <tbody> <tr> <td>red</td> <td class="lastmodified">{{item.reddate}}</td> <td class="status"> <select id ="red" class="form-control" ng-change="update();" ng-model="item.redstatus"> <option value="" disabled="" selected="" class="ng-binding">please select value</option> <option ng-selected="step.value === item.redstatus" ng-repeat="(key, step) in steps">{{ step.title }}</option> </select> </td> </tr> <tr>green</tr> <tr> .... </tr> </tbody> so, simple date , status values red, green , blue. 1 in dropdown - status, second - output date. on change select value -...

java - How to escape slashes in Gson -

according json specs, escaping " / " optional. gson not default, dealing webservice expecting escaped " / ". want send " somestring\\/someotherstring ". ideas on how achieve this? to make things clearer: if try deserialize " \\/ " gson, send " \\\\/ ", not want! answer: custom serializer you can write own custom serializer - have created 1 follows rule want / \\/ if string escaped want stay \\/ , not \\\\/ . package com.dominikangerer.q29396608; import java.lang.reflect.type; import com.google.gson.jsonelement; import com.google.gson.jsonprimitive; import com.google.gson.jsonserializationcontext; import com.google.gson.jsonserializer; public class escapestringserializer implements jsonserializer<string> { @override public jsonelement serialize(string src, type typeofsrc, jsonserializationcontext context) { src = createescapedstring(src); return new jsonprimitive(src...

python - How do I load an index (Dow, Nasdaq) with Zipline? -

loading individual stocks no problem struggeling loading stock indexes while thought should share. if want load index zipline add stock parameter this: data = load_from_yahoo(stocks=['aapl', '^gspc', '^ixic'], indexes={}, start=datetime(2014, 1, 1), end=datetime(2015,4,2)) this load both apple's stock prices, nasdaq composite , s&p500.

Crystal reports cross-tab month date function -

i have cross-tab table want group each column specific month each year. (ex. march 2011, march 2012, march 2013 , on). i'm guessing formula needed since there's no predefined functions in cr can me group dates that. is true?

java - What does configureDefaultServletHandling means? -

i trying understand how spring mvc works, , don't understand part of code in spring configurations: @override public void configuredefaultservlethandling(defaultservlethandlerconfigurer configurer) { configurer.enable(); } when in webcontextapplication class, works fine , when it's not present works fine too. purpose of method? should webcontextapplication class have method? , why? as jb nizet tried explain both used serve static resources. so question java based spring configuration has @override public void addresourcehandlers(resourcehandlerregistry registry) { registry.addresourcehandler("/assets/**").addresourcelocations("/resources/bootstrap/"); } then why need @override public void configuredefaultservlethandling(defaultservlethandlerconfigurer configurer) { configurer.enable(); } or why <mvc:default-servlet-handler/> if have <mvc:resources mapping="/assets/**" location="/reso...

angularjs - How to use Node modules on the client side? -

after installing packages via npm, such as: $ npm install bootstrap or $ npm install angular these saved inside "node_modules" default. how access them (link them) html page? can't possibly "href="/node_modules/", what's solution? i imagine like: var angular = require("angular"); but i'm not sure. try use bower , or yeoman . bower - simplify process include js libs yeoman - build projects the libraries need.

collections - Setting visiblilty of control using LINQ -

i'm working on refactoring code practice linq. reason can't code cooperate. //actioncontrols controlcollection var actioncontrols = flowlayoutpanel1.filtercontrols(c => c button); //todo: optimize foreach(var control in actioncontrols) { control.visible = workingitemdatatable.asenumerable().any(row => "btn" + row.field<string>("name") == control.name); } what trying now. flowlayoutpanel1.filtercontrols(c => c button && c.name == "btntaskinfo"//btntaskinfo visible || workingitemdatatable.asenumerable().any(row => "btn" + row.field<string>("name") == c.name)).cast<button>() but after casting button, can not figure out how set visible = false. advice? you'd still need iterate controls, can this, assuming filtercontrols isn't more alias where: var actioncontrols = flowlayoutpanel1.oftype<button>(); there "tri...

c - How to implement a language interpreter without regular expressions? -

i attempting write interpreted programming language read in files , output bytecode-like format can executed virtual machine. my original plan was: begin loading contents of file in memory of interpreter, read each line (where word defined being series of letters followed space or escape character), using regular expressions, determine parameters of word, for example, if myvalue = 5 then become if myvalue 5 , convert each of these words byte form (i.e. if become 0x09 ), execute these bytes 1 one (as executor understand if or 0x09 followed 2 bytes. i have been told regular expressions terrible way go doing this, i'm unsure if or bad way of implementing interpreted language. this experience, don't mind if isn't performance friendly, benefit. what best way of implementing interpreter, , there examples (written in plain old c)? the reason why people tell regular expressions aren't best idea case because regular expressions take more time ...

linux - Geany: How to find and count? -

Image
i know of rather powerful feature in notepad++ can search entire document specific string , count number of occurrences. in find function (ctrl+f). e.g. data: error reading file error reading file error in line #3 error reading file error in line #5 find & count*: "line" = 2 i not seem find this* function in geany. if there plugin this, please share it. otherwise, please share on how 1 same -- without switching editor. you can check message output. after searching check "messages" tab.

node.js - Selenium Standalone server NodeJS, remote browsers -

i'm trying set selenium test environment having little trouble due fact browsers launched remotely via virtualization launcher service. path looks this: "c:\program files (x86)\microsoft application virtualization client\sfttray.exe" /launch "mozilla firefox 32 32.0.0.5350" my problem, can guess, server can't find path of browser binaries. i'd direct find webdrivers (iedriver.exe, chromedriver.exe, etc.) nice. has else run problem? there way set through nodejs co-workers don't have configure launch setup individually too? for chrome when launching hub or node command line use flag: -dwebdriver.chrome.driver=path_to_chromedriver where path_to _chromedriver directory put chromedriver. me /vagrant/bin/chromedriver giving: -dwebdriver.chrome.driver=/vagrant/bin/chromedriver for binaries- in java looks can use this: firefoxbinary binary = new firefoxbinary(new file("path/to/binary")); firefoxprofile profile = new fir...

node.js - Highland.js for CSV parsing -

i'm trying write functional manner. we're using highland.js managing stream processing, because i'm new think i'm getting confused how can deal unique situation. the issue here data in file stream not consistent. first line in file typically header, want store memory , zip rows in stream afterwards. here's first go @ it: var _ = require('highland'); var fs = require('fs'); var stream = fs.createreadstream('./data/gigfile.txt'); var output = fs.createwritestream('output.txt'); var headers = []; var through = _.pipeline( _.split(), _.head(), _.doto(function(col) { headers = col.split(','); return headers; }), ...... _.splitby(','), _.zip(headers), _.wrapcallback(process) ); _(stream) .pipe(through) .pipe(output); the first command in pipeline split files lines. next grabs header , doto declares global variable. problem next few lines in str...

Making Conditional Formatting for a SUMIF filter in Google Sheets relative? -

i have handy little google sheet formula applies color given summed total can't formula relative. suspect either easy genius fix or impossible in sheets. help? sorry can't post images, here's rough simulation of table a1 - b4 john doe | 25% martha roe | 25% john doe | 75% jane doe | 25% in table above, i'm using conditional formatting "format cells if..custom formula is..." , formula sums values in column b john roe , martha roe (column a) , turns both name , value cell red if value exceeds 100%. use formula below: =sum(filter(b$1:$b4,a$1:a$4 = a1)) >= 100% (full credit spreadsheetpro.net's article intro sumifs, countifs, & averageifs functions in google spreadsheet.) unfortunately, when use conditional formatting approach , drag formula next cell in row, still thinks mean a1 (not a2); it's applying original formula multiple rows. right need manually change formula each cell. maddening. what i'd have update relat...

java - JTextfield UML Class Diagram -

i'm having 2 classes specific purpose in project, doing putting related gui in let's class 1 , functionality , data manipulations in class 2. class 2 contain member variables such int, string represented on class diagram. class 1, have member variables of type jtextfield, jcombobox, among others used in gui. my question : show member variables such jtextfield on class diagram? do show member variables such jtextfield on class diagram? no only variables need mentioned in class diagram. for specifications of variable, create 1 more file (known uispecification) , there mention type of variable like variable type str text usually uispecification file made in xl sheet

sql - Pass value in php -

hi have modules links in student page after click on 1 of these links want pass id of specific module next page,so how can pass id value , code, please help. $sql = "select * module,user user_access_level = module_level , '$user_id' = user_login "; $result = $db->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { echo '<li><a href="personal.php?id=".$g['module_id']."\">'.$row["module_id"].' '.$row["module_name"].' '.$row["module_points"].'</a></li> '; } } here code of quotes, concatenations, backticks , backward logic corrected: $sql = "select * `module`, `user` `user_access_level` = 'module_level' , `user_login` = '". $user_id."' "; $result = $db->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()...

regex - Notepad++ regular expression: line does not contain certain pattern -

i have following list of objects: type="user" n="ag12345" status="active" type="user" n="he98745" status="active" type="user" n="user1" status="active" type="user" n="84566" status="active" type="user" n="iu78965" status="active" i need find lines tag "n" not match pattern @@#####. in other words valid user has created 2 consecutive alphabetic characters , 5 numbers. regular expression looking should show me lines: type="user" n="user1" status="active" type="user" n="84566" status="active" i've tried many many things can't seem understand how this. one of attempts was: find what: type=user" n="(?![\l]{2}[\d]{5})" status="active" and also: type=user" n="(?![\l]{2})(?![\d]{5})" status="active"...

animateWithDuration in Swift - Could not find member 'CurveEaseOut' -

i following error when attempting pass variable in animation in swift: could not find member 'curveeaseout' my code seems fine if type degrees in manually: uiview.animatewithduration(2.0, delay: nstimeinterval(0.0), options: .curveeaseout, animations: { self.arrowimage.transform = cgaffinetransformmakerotation((180.0 * cgfloat(m_pi)) / 180.0) }, completion: nil) but have issue if attempt use variable: var turn = double() turn = 180.0 uiview.animatewithduration(2.0, delay: nstimeinterval(0.0), options: .curveeaseout, animations: { self.arrowimage.transform = cgaffinetransformmakerotation((turn * cgfloat(m_pi)) / turn) }, completion: nil) perhaps it's use of double()? i've tried various different types , can't find solution. there nothing wrong .curveeaseout. problem think within closure. try var turn:cgfloat = 180.0 if error remains arrowimage optional , have use if let unwrapped it uiview.animatewithduration...

How should/could/must I handle the dll that my C++ projects depend on? -

i'm lost here , have no clue how proceed. not question how make program work, question how stop wasting time. my programming environment visual studio 2013 on windows, in c++. i use 3 libraries extensively, namely: boost (using dynamic linking), opencv, , qt. during development, have configured vs @ 3 libraries default include , .lib. have added 3 folders containing dlls path environment variable. it works, sometime painful, let me explain when. first hassle: anytime have lnk error telling me miss function, on opencv since has 1 include file referencing functions. have @ opencv's source code see module function belongs , know must link program to. second hassle: when comes time deploy application, have ship relevant dlls. know 1 need, open dependency walker , try forget nothing, have test on different computer because 102% of time have missed couple, , have configure installer generator include 1 one. third hassle: ease little bit process of configuring new dev...

perl - installing texinfo on redhat centos 7 ppc64 -

i new redhat , install r-devel . i tried install using following command: yum install r-devel but leads first error below... i on centos 7 ppc64 architecture... i have got point of needing install texinfo-tex , lapack-devel , blas-devel . please see below: error: package: r-core-devel-3.1.3-1.el7.ppc64 (epel) requires: texinfo-tex error: package: r-core-devel-3.1.3-1.el7.ppc64 (epel) requires: lapack-devel error: package: r-core-devel-3.1.3-1.el7.ppc64 (epel) requires: blas-devel >= 3.0 yum install texinfo-tex not seem work says no package texinfo-tex available . so downloaded .rpm , used following command...to try , install it su -c 'rpm -uvh texinfo-5.2-7.fc22.ppc64.rpm' with following error warning: texinfo-5.2-7.fc22.ppc64.rpm: header v3 rsa/sha1 signature, key id xxxxxx:nokey error: failed dependencies: perl(unicode::eastasianwidth) needed texinfo-5.2-7.fc22.ppc64 so try , install dependency perl(unicod...

Quit MPMoviePlayer on entering background in iOS Objective-C -

mpmovieplayer presented on rootviewcontroller.on entering background, have popped mpmovieplayercontroller. on entering foreground,the movie player screen splashed second , disappears. what need not show movie player view on entering foreground. there way achieve ? it's because system takes snapshot of application’s main window when application moves on background, presented when enter foreground. hope understand things better. prevent ios taking screen capture of app before going background the exact moment ios takes view snapshot when entering background?

jquery - Getting ias working with ajax + pods in Wordpress -

so want infinite scroll ( http://infiniteajaxscroll.com/ ) work html part is: <div id="pagination"> <span class="pods-pagination-paginate "> <span class="page-numbers current">1</span> <a class="page-numbers" href="?action=search_speaker&amp;sort=az&amp;pg=2">2</a> <a class="page-numbers" href="?action=search_speaker&amp;sort=az&amp;pg=3">3</a> <a class="next page-numbers" href="?action=search_speaker&amp;sort=az&amp;pg=2">next ›</a> </span> </div> <div class="wrapper-pane clearfix"> <div class="pane"></div> <div class="pane"></div> <div class="pane"></div> <div class="pane"></div> </div> the js code is: var ias = jquery.ias({ container: ".wrapper-pane", item: ".pa...

elasticsearch - Kibana 4 detects geodata but doesn't display any results on the map -

i have created elasticsearch index data set containing geodata. have set mapping data. tried create kibana visualisation using data set. kibana detects geodata property finds no result though there plenty of. ran test on data set different , simpler layout, , kibana visualised geodata. here's sample works: "location": { "lat": 56.290525, "lon": -30.163298 }, and mapping: "location": { "type": "geo_point", "lat_lon": true, "geohash": true } and 1 doesn't work: "groupoflocations": { "@type": "point", "locationfordisplay": { "lat": 59.21232, "lon": 9.603803 } } and mapping: { ... // nested type ...

c# - SpecFlow: System.FormatException: Input string was not in a correct format -

i getting following error when running tests using specflow: system.formatexception: input string not in correct format. and took me while work out why happening. it ended being because had omitted single quotes in 1 of step definitions, example: [then(@"something adds quantity of (.*)")] when should have been [then(@"something adds quantity of '(.*)'")] note single quotes around (.*)

mysql - PHP link security -

i've newssystem link index.php?article=news&id=10 , work comments mysqli_query($db, "select * news_comments news_id = '10'"); but when change link example index.php?article=news&id=10=asd comments not there, because added asd @ end. can me? you'll need ensure value of "id" integer. not sure code looks like, like: $id = intval($_get['id']); mysqli_query($db, "select * news_comments news_id = '$id'"); you sanitizing input correct?

java - Calling Graphics function from another functionJava -

i trying button call graphics function in java take lives left , draw appropriate parts hang man game. working except drawing. believe because of way calling function i'm not sure. thanks code button: if(temptext == label.gettext()){ lives--; panel2.paintcomponent(); if (lives == 0){ joptionpane.showmessagedialog(null,"you lose"); buttona.setenabled(false); buttonb.setenabled(false); buttonc.setenabled(false); buttond.setenabled(false); buttone.setenabled(false); buttonf.setenabled(false); buttong.setenabled(false); buttonh.setenabled(false); buttoni.setenabled(false); buttonj.setenabled(false); buttonk.setenabled(false); buttonl.setenabled(false); buttonm.setenabled(false); buttonn.setenabled(false); ...

java - Dynamically change drawable colors -

in application have lot of drawables defined xml files. example have button defined that: button.xml <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <!-- bottom 3dp shadow --> <item android:top="3dp"> <shape android:shape="rectangle"> <corners android:radius="3dp" /> <solid android:color="@color/black_30" /> </shape> </item> <!-- green top color --> <item android:top="3dp" android:bottom="3dp" android:id="@+id/background"> <shape android:shape="rectangle"> <corners android:radius="3dp" /> <solid android:color="@color/green1" /> </shape> </item> </layer-list> and display button that: layout.xml <button android:...

html - highlight the image icon when clicked on it -

i have 3 images icons different use. now want is, if first icon clicked, first icon should highlighted , if second clicked second icon should highlighted . please see html ref:- <tr> <td width="18%" height="40" align="left" valign="middle"></td> <td style="text-align: left; vertical-align: middle;" width="6%"> <input type="checkbox" id="branchchkbx" title="branch" checked="checked" class="hidechkbx" /> <a href="locatebranches_rbl_view.aspx" style="color: #666; font-family: 'signika_negativeregular', sans-serif;"> <img alt="branch" src="images/branch_icon.png" height="40" width="40" title="branch" style="border: 0;" /> <p class="para01">branch</...

How does the Enumeration.Value of a scala enumeration knows the name of the member? -

in scala, can create enumeration this: object weekday extends enumeration { val monday, tuesday = value } you can call tostring() name of member @ runtime val name = weekday.monday.tostring // name = "monday" how possible? value method creates new object time, how can method access name of declared member without of compiler? pure scala magic me.

AngularJS Performance: conditional inline classes/ng-if vs controller function; -

i have controller lots of conditional inline classes helps change style(e.g. game in progress , completed game has different font colors) , ng-if conditional representation (e.g display short name vs full name if team consist of 2 people) of elements depending on values of incoming data. example of ng-if: <span ng-if="(isshortname && eventtype == 's')|| eventtype == 'd'" ng-bind="player.shortname"></span> <span ng-if="(!isshortname && eventtype == 's')" ng-bind="(player.firstname + ' ' + player.lastname)"></span> since same layout used multiple times (many events @ same time), created directive displays 1 event , ng-repeat apply directive multiple events incoming data. this event directive have directives e.g display header of table. the amount of incoming of data huge. many bindings noticing slowing in performance. i wondering view of best practices , performa...

hp uft - UFT and HP ALM connectivty -

i have installed hp uft v12.01 , when trying connect via hp uft hp alm quality center v11.0 , following error: failed update components server. failed hosting spider activex any suggestions? if logging alm first, , connecting alm through uft not work (as suggested vvvaib above), try this: - open uft administrator (right-click on icon, select "run administrator") , try logging alm.

azure - Best Practice: Calling separate Web-API Service from Single Page Application (SPA) -

hy all we discussing around architecture of following scenario: single page application (javascript driven html5 application asp.net webapi) separate rest service (webapi only) businesslogic, dal, database-connectivity security on azure ad (adal) what the way call rest-service single page application? at moment seeing possibilities: 1) calling rest-service directly client (browser) via cors: client (browser) -> rest-service ...like in example: https://github.com/azureadsamples/singlepageapp-webapi-angularjs-dotnet 2) calling webapi-service single page application, calls rest-service: client (browser) -> webapi spa -> rest-service for first variant, see security questions. save this? if rest-service in internal network , spa in dmz? for second variant, best practices here? because need our controllers: spa controller example: //get /api/models public iqueryable<model> get() { // create httpclient instance var resp = client.getasync(...

node.js - Mongoose $ project -

using mongoose 4.0.x , need execute following (working) mongodb query: db.bookings.find( { user: objectid("10"), // replaced real id 'flights.busy.from': {$gte: isodate("2015-04-01t00:00:00z")}, 'flights.busy.to': {$lte: isodate("2015-04-01t23:59:00z")} }, { 'flights.$': 1 // don't know replicate } ).pretty() the mongoose find operator not accept projection operator, mongodb find 1 does. how can replicate above query in mongoose? filtering array once query returned solution avoid. you want @ docs model.find , not query.find . second parameter can used field selection: mymodel.find( { user: objectid("10"), // replaced real id 'flights.busy.from': {$gte: isodate("2015-04-01t00:00:00z")}, 'flights.busy.to': {$lte: isodate("2015-04-01t23:59:00z")} }, 'flights.$' ).exec(function(err, docs) {...});

c++ - Synchronizing mutiple processes in C with shared memory -

i have program creates child processes in loop fork(). child create other processes well. all processes must increment count, , count must displayed @ end. to used simple locking system. shared memory of size 2. there 2 variable of type sig_tomic_t: count , lock. when process wants increment count sets lock 1, increments count, sets lock 0. otherwise, if lock 1, process sleeps. here code segment of interest. for(i = 1; <= 10; i++) { if((pid = fork()) < 0) { perror("error fork!"); exit(2); } if(*lock == 0) { *lock = 1; *count = *count + 1; *lock = 0; } else { while(*lock == 1) { sleep(1); } } } the problem though used simple locking system, count isn't incremented correctly.

laravel - Unit test ignore log level -

i have log level defined in config/app.php emergency . 'log' => 'syslog', 'log_level' => env('log_level','warning'), throughout applications have log::info('info') in several places. meaning info should ignore because log level set emergency. works great when run application, problem when run unit tests phpunit . log level ignored logs everything. anyone have idea why happen? in versions of monolog (i'm not seeing on master branch now), monology outputs stderr when no handler set: https://github.com/seldaek/monolog/blob/1.22.0/src/monolog/logger.php#l288-l290 pushing handler onto monolog, null one, supress logging: https://github.com/seldaek/monolog/blob/master/src/monolog/handler/nullhandler.php

javascript - How to get youtube audio data through given url -

currently i'm working on audio data analyzing project. i want let user key in youtube url and url's youtube audio data website. after getting data want store them in 1-d array further signal processing. can task finished via javascript? thanks in advance. btw, audio data :(for example:wav audio format) [0.5,0.9,0.26,0.44,0.23,0.01,0.11,0.54,......] take here: https://developers.google.com/youtube/terms ii. prohibitions ... separate, isolate, or modify audio or video components of youtube audiovisual content made available through youtube api; promote separately audio or video components of youtube audiovisual content made available through youtube api; so can't separate audio video.

java - In Hibernate Query Language is there any way to select from the result of Inner Query? -

i want select count of result of sub query e.g. select count(*) (select * entity group ); is there way in hql? hql subqueries can occur in select or clauses. hibernate subqsueries

html - VB.NET/GetElementByClass how to div class click? -

</div></div></div><div class="f u" id="m_more_item"><a href="/browse/likes/?id=1026395497374065&amp;start=30&amp;refid=53"><span>diğerlerini gör</span></a></div></div></div></div></div></div></div></body></html> document code: dim h1 htmlelementcollection = nothing h1 = w.document.getelementsbytagname("div") each curelement htmlelement in h1 if instr(curelement.getattribute("classname").tostring, "f u") curelement.invokemember("click") but code not work me ? off example: vb.net - select class using getelementbyclass , click item programmatically the problem trying click div instead of trying click href tag. want instead. since there no "class" or on element, like... dim h1 htmlelementcollection = nothing h1 = w.document.getelementsbytagnam...

python - How to convert a script to UTF-8 -

i have sikuli/python script works good. since dutch have same letters in our alphabet english alphabet. now there 1 letter have not occur in alphabet, used in dutch grammar. ë. sikuli falls on becuase doesn't belong in english alphabet. have belgium custumers might use french on in future. how can make scripts @ utf-8, , not @ ascii (what seems default)? in order specify module shall include utf-8 encoding, use encoding declaration in header or footer of file, per pep 0263 : # -*- coding: utf-8 -*-

regex - Regular Expression Split on character not in Qualified String (python) -

i use assistance easy familiar. i'm trying parse more/less shop-brewed configuration files dictionary/json. have python code using string procedures or re.split() works fine i've tested against; however, know there corner cases could break , create generic regular expressions better handle logic, , same regex portable other languages (perl,awk,c,etc) use @ work consistent. i looking either use re.match() or re.split() in python. the patterns i'm looking should following: 1) split str on first ? if ? not in substring qualified single and/or double quotes. strin: ''' foo = 'some',"stuff?",'that "could be?" nested?', ? still capture this? , "this?" ''' listout ['''foo = 'some',"stuff?",'that "could be?" nested?', ''' , ''' still capture this? , "this?"'''] 2) split str on first # if # not in substr...

Scala: how to flatten a List of a Set of filepaths -

i have list[set[path]] : update : each path in set unique , represents particular directory location. there no duplicates. so, looking total number of path elements/ val micedata = list(set(c:\users\lulu\documents\mice_data\data_mining_folder\deeplynesteddirectory\flatdirectory\test7.txt, c:\users\lulu\documents\mice_data\data_mining_folder\deeplynesteddirectory\flatdirectory\test2.txt, c:\users\lulu\documents\mice_data\data_mining_folder\deeplynesteddirectory\flatdirectory\test6.txt, c:\users\lulu\documents\mice_data\data_mining_folder\deeplynesteddirectory\flatdirectory\test5.txt, c:\users\lulu\documents\mice_data\data_mining_folder\deeplynesteddirectory\flatdirectory\test8.txt, c:\users\lulu\documents\mice_data\data_mining_folder\deeplynesteddirectory\flatdirectory\test3.txt, c:\users\lulu\documents\mice_data\data_mining_folder\apowerpoint.pptx, c:\users\lulu\documents\mice_data\data_mining_folder\deeplynesteddirectory\flatdirectory\test1.txt, c:\users\lulu\documents\...

c++ - Declare static functions as friend function? -

i have class myclass declaration in header file interface.h , static functions ( foo , bar , few more) in file1.cpp . static functions used inside file1.cpp need modify private/protected members of myclass`. // in "interface.h" class myclass { // maybe declare friend? // friend static void foo(myclass &ref); private: double someval; } // in "file1.cpp" static void foo(myclass &ref) { ref.someval = 41.0; } static void bar(myclass &ref) { ref.someval = 0.42; } // function uses foo/bar void dosomething(myclass &ref) { foo(ref); } idea 1 : somehow declare them friends of myclass ? why not good : static , in different compilation unit. besides expose them user of myclass not need know them. idea 2 : don't have idea 2. sort of linked: is possible declare friend function static? sort of linked: possible declare friend function static? personally find whole friend thing bit of hack breaks e...

in app - Android in app purchases: is it possible to buy few subscriptions at same time? -

from google documentation don't understand - 1 subscription can active @ same time? or possible buy few subscriptions simultaneously? please explain me. you can create multiple products , configure attributes subscription each subscription product quoting the docs configuring subscriptions to create , manage subscriptions, can use developer console set product list app, configure these attributes each subscription product: purchase type: set subscription subscription id: identifier subscription publishing state: unpublished/published language: default language displaying subscription title: title of subscription product description: details tell user subscription price: default price of subscription per recurrence recurrence: interval of billing recurrence additional currency pricing (can auto-filled)

Send file to ftp server using sockets in C -

i trying upload file ftp server using sockets. connects server , can read directories doesn't upload file. "stor" command creates file in server empty content. why getting "no data connection" response server , file empty? #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <netdb.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <arpa/inet.h> int main(int argc, char *argv[]) { argv[0]="2"; argv[1]="ip"; int sockfd = 0, n = 0; char recvbuff[1024]; struct sockaddr_in serv_addr; char mesuser[100]="user ftpuser\n"; char mespass[100]="pass pass\n"; char mestor[100]="stor xx\n"; char mespasv[100]="pasv\n"; char meappe[100]="appe xx\n"; argc=2; if(argc != 2) { printf("\n usage: %s...