Posts

Showing posts from May, 2012

android - Facebook SDK 4.0 get additional permissions -

in app want ask permissions log-in user , publish_actions . want publish picture on user wall after action when ask publish permissions request cancelled. using loginwithpublishpermissions needed permissions. tried mauthbtn.cancelpermission() but nothing changed. looking way obtain both permissions, if not together. loginbutton = (loginbutton) view.findviewbyid(r.id.login_button); loginbutton.setreadpermissions(arrays.aslist("public_profile,user_birthday,email")); as can see in above example asking birthday email , public profile. can same permission need. since want post app must reviewed facebook allow post

ruby on rails - Pass a PORO from view to controller -

what best way pass plain old ruby object have in view controller method? it not object persisted in db. rather not refactor things , want ideas on best way pass object. view link_to "activate", activate_apis_path(my_ip_instance: @my_ip), class: "btn btn-primary btn-xs" controller @my_ip = params[:my_ip_instance] @my_ip string... want whole object (rails 4.2) usually best way through form. consider creating form hidden fields of @my_ip attributes. <%= form_tag activate_apis_path %> <%= hidden_field_tag "my_ip_instance[foo]", @my_ip.foo %> <%= hidden_field_tag "my_ip_instance[tomato]", @my_ip.tomato %> <%= submit_tag "activate", class: "btn btn-primary btn-xs" %> <% end %> (extra credit: loop on @my_ip 's attributes generate hidden fields.) another way serialize @my_ip json , deserialize in controller. think messier though. link_to "activate"

javascript - Bootstrap Switch in Datagrid -

Image
im rendering datagrid in asp.net vb, want incorporate bootstrap switch, can target 1 row html: <asp:templatecolumn headertext="allow text" itemstyle-width="1px" headerstyle-width="1px"> <itemtemplate> <asp:checkbox id="cbtxt" runat="server" checked='<%# container.dataitem("allowtxt")%>'/> </itemtemplate> </asp:templatecolumn> jquery: $("[id='contentplaceholder1_dgnames_cbtxt_1']").bootstrapswitch(); i 1 working accessing chrome developer console, when tried dropping "1" @ end, didnt work, work if have full id, , nothing more. there way around this?! display console the answer question can found on here . class added <asp:checkbox> wasnt being picked when page rendered. in reference @mark , link above, added class checkbox through jquery, before initialized bootstrap switch: $("input[type=check

cmd - FORFILES file not found -

a file specified in /c parameter of forfiles command in batch file not being located. forfiles /p "%csv_path%" /m "*.csv" /c "cmd /c sqlcmd -s %db_server% -d %db% -e -i scripts\loadstationcsv.sql -o loadstationcsv.log -v temptable = ##dayparts csvpath = @path" sql cmd shows following error: sqlcmd: error: error occurred while opening or operating on file scripts\loadstationcsv.sql (reason: system cannot find path specified). executed command line, sqlcmd runs parameters above. scripts/loadstationcsv.sql file exists.

xml - List<JAXBElement> in adapter code impacting JSON format -

i format json output contain string objects having 1 element , not array. below pojo. @component("myvo") @scope("prototype") @xmlrootelement @xmlaccessortype(xmlaccesstype.none) @xmltype(proporder = {"a", "b", "c", "d", "e", "f", "sectionlist"}) public class myvo extends serviceresponseto { private static final long serialversionuid = -9190950749517871535l; @xmlelement(name="abc") private string a; @xmlelement(name="def") private string b; @xmlelement(name="ghi") private string c; @xmlelement(name="jkl") private string d; @xmlelement(name="mno") private string e; @xmlelement(name="pqr") private string f; @xmlelement(name="section") @xmljavatypeadapter(myadapter.class) private list<map<string, string>> sectionlist ; //corresponding getters , setters @override public string tostring() { return

R scientific notation in plots -

Image
i have simple plot: #!/usr/bin/rscript png('plot.png') y <- c(102, 258, 2314) x <- c(482563, 922167, 4462665) plot(x,y) dev.off() r uses 500, 1000, 1500, etc y axis. there way can use scientific notation y axis , put * 10^3 on top of axis figure below? this sort of hacky way, there's nothing wrong it: plot(x,y/1e3, ylab="y /10^3")

applescript (automator) how can I access properties of the selected image in keynote? -

tell application "keynote" activate tell front document tell current slide set imageitem **image 1** end tell end tell end tell when use such script, can access images index. however, if want selected image in keynote, should do? thank much! this not possible, because keynote doesn't have selection property

c# - 2D Graphic in Windows Universal App -

i thinking upcoming school project focused on windows 10 universal apps , ran interesting experiment : https://www.chromeexperiments.com/experiment/stochasticity i want work on similiar or achieve similar level of animation in metro universal application writen in csharp. have never worked sort of animation or 2d graphics while writing wua. can direct me right way start ? recommendation, possible..any particular sample codes ? thank you. for 2d raster graphics take @ win2d . win2d windows runtime wrapper on direct2d , enables high performance 2d rendering similar experiment html canvas. canvasanimatedcontrol designed scenarios think you're looking for. see introduction , quick start on github started , more samples.

javascript - Using HTML file to Query a Google Spreadsheet using a Textbox for Query, using App Script -

i have spreadsheet have more 1000 lines, each column field, 1 of columns has field called domain, "which value need query", application using html need query using text box html function, search spreadsheet , return values of same line in html. now here html code: <html> <head> <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/angular_material/0.10.0/angular-material.min.css"> <link rel="stylesheet" href="https://storage.googleapis.com/code.getmdl.io/1.0.0/material.blue-green.min.css" /> <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-route.js"></script> <script src="//ajax.googleapis.com/ajax/libs/a

android - How to handle SharePhoto result with Callbackmanager? -

my users posting photos facebook , want know that. in last sdk used code callback: uihelper.onactivityresult(requestcode & 0xffff, resultcode, data, new facebookdialog.callback() { @override public void oncomplete(facebookdialog.pendingcall pendingcall, final bundle data) { iscomplete = facebookdialog.getnativedialogdidcomplete(data); (bitmap bitmap : images) { getridofbitmapifneeded(bitmap); } //get rid of stored references bitmapss images.clear(); if (iscomplete) { string completiongesture = facebookdialog.getnativedialogcompletiongesture(data); if (completiongesture == null || facebookdialog.completion_gesture_cancel.equals(completiongesture)) { //show publish cancel toast log.d("facebook iscomplete", "user canceled"); setreadytoclick(); } else { string id = data.getstring(&quo

linux - C++ libcurl set proxy from a configuration file -

i use libcurl make http tests , managed configure proxy settings code: curl_easy_setopt(curl, curlopt_proxy, _proxy); curl_easy_setopt(curl, curlopt_proxyuserpwd, userpass); i testing on linux , want know if can use configuration file configure proxy settings.

java - Trying to create toolbar and getting rendering error -

im trying create toolbar im getting error. searched , didnt found solution. error: following classes not found: android.support.v7.widget api version 16. styles.xml file: <style name="apptheme" parent="theme.appcompat.light.noactionbar"> <item name="colorprimary">@color/colorprimary</item> <item name="colorprimarydark">@color/colorprimarydark</item> <!-- customize theme here. --> </style>

javascript - Two functions on Keypress won't work (textarea) -

i have created 2 function on enter key press to hide show dive on enter key press to auto resize textarea height on enter when reached end. here fiddle : http://jsfiddle.net/rz3f3gng/2/ $('.one').hide(); $(function() { //hide show dive on enter press , on other keys hide div $('#maincontent').on('keypress', function(e) { if (e.which == 13) { e.preventdefault(); $('.one').show(); } else { $('.one').hide(); } }); function textareaauto(o) { o.style.height = "200px"; o.style.height = (2 + o.scrollheight) + "px"; } }); .one { width: 100px; height: 30px; background: red; } textarea { overflow: hidden; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <div class="one"> </div> <textarea id="maincontent" onkeydown="textareaauto(

Difference between forecast and predict function in R -

is there difference between predict() , forecast() functions in r? if yes, in specific cases should used? intro predict -- many kinds of r objects (models). part of base library. forecast -- time series. part of forecast package. (see example). example #load training data trndata = read.csv("http://www.bodowinter.com/tutorial/politeness_data.csv") model <- lm(frequency ~ attitude + scenario, trndata) #create test data tstdata <- t(cbind(c("h1", "h", 2, "pol", 185), c("m1", "m", 1, "pol", 115), c("m1", "m", 1, "inf", 118), c("f1", "f", 3, "inf", 210))) tstdata <- data.frame(tstdata,stringsasfactors = f) colnames(tstdata) <- colnames(trndata) tstdata[,3]=as.numeric(tstdata[,3]) tstdata[,5]=as.numeric(tstdata[,5]) cbind(obs=tstdata$frequency,pred=predict(model,n

Excel VBA Copy/Paste Range to the next available cell in another worksheet -

what want do: filter on array, copy filtered data onto different workbook. copy data pasted onto worksheet in same workbook, time below existing data. my thinking: code used below used me copy , paste 1 workbook workbook , worked perfectly, wb.sheets("2014 current week").range("c2:cc10000").copy nwb.sheets("2014 ytd").range("c" & rows.count).end(xlup).offset(1, 0) but seems not work same way if want copy in same workbook. appreciated. thanks! dim wb workbook dim strs string dim str string dim nwb workbook set wb = thisworkbook strs = wb.sheets("macros").range("h5") 'the 2014 address can found in full in cell h5 in macros tab set nwb = workbooks.open(strs) 'address of new workbook , opens activesheet .autofiltermode = false 'filter , here' end nwb.sheets("all data").range("a1:ca100000").copy wb.sheets("2014 current week").range("c" & rows.co

javascript - jQuery on click for two buttons in same div -

i have site displays bar graphs of data. trying implement pagination graphs user can click 'next' or 'previous' scroll through different subsets of total data. here html section in question: <div class="graph_fields_wrap1 row backdrop col-lg-12"> <div class="col-lg-6"> <h3 class="titles">top ten author citations</h3> <h4 class="titles">all time (from 1970)</h4> <button class="pager" id="previous1" type="button"><span class="glyphicon glyphicon-chevron-left"></span> previous</button> <button class="pager" id="next1" type="button">next <span class="glyphicon glyphicon-chevron-right"></span></button> <div class="chart1 bs-component"></div> </div> <div class="col-lg-6">

javascript - Adding numbers together -

i want loop on array whilst addding numbers together. whilst looping on array, add current number next. my array looks [0,1,0,4,1] i following; [0,1,0,4,1] - 0+1= 1, 1+0= 1, 0+4=4, 4+1=5 which give me [1,1,4,5] following; 1+1 = 2, 1+4=5, 4+5=9 and on until 85. could advise on best way go this transform follows specified method of summation, end result of 21, please specify how 85. var ary = [0,1,0,4,1], transform = function (ary) { var length = ary.length; return ary.reduce(function (acc, val, index, ary) { if (index + 1 !== length) acc.push(ary[index] + ary[index + 1]); return acc; }, []); }; while (ary.length !== 1) ary = transform(ary);

What are the constraints of Swift's array syntax? -

i'm working through exercises in the swift programming language , , 1 thing noted odd array syntax. per this answer , array<t.generator.element>() works, yet var common = [t.generator.element]() not. @ same time, var common: [t.generator.element] = [] correct. what rules around array syntax/initialization? why doesn't second line work?

Unit test Laravel middleware -

i trying write unit tests middleware in laravel. know tutorial, or have example of ? i have been writing lot of code, there must better way test handle method. using laravel 5.2, unit testing middleware passing request input , closure assertions. so have middleware class getcommandfromslack parses first word of text field in post (the text slack slash command) new field called command , modifies text field not have first word more. has 1 method following signature: public function handle(\illuminate\http\request $request, closure $next) . my test case looks this: use app\http\middleware\getcommandfromslack; use illuminate\http\request; class commandsfromslacktest extends testcase { public function testshouldknowliftcommand() { $request = new illuminate\http\request(); $request->replace([ 'text' => 'lift foo bar baz', ]); $mw = new \app\http\middleware\getcommandfromslack; $mw->handle($request,function($r)

jquery - Fixed Header Issue - addClass doesn't work on page load -

i trying build hidden header has appear once scroll web page below 100px. header contains logo has hidden well. issue on page load hidden same has be, on scroll head appears, logo still missing. if refresh page when below 100px top logo appears , works fine if go on top. could please explain might reason behind issue not find proper solution. html <header> <a id="logo" href="index.html"></a> </header> css header{ position: fixed; top: -50px; left: 80px; height: 50px; width: 100%; background: rgba(255,255,255, 0.9); z-index:9999; transition: 0.3s ease-in-out; } header.show{ top:0; } a#logo{ display: block; position:absolute; top: inherit; left: -80px; width: 80px; height: 50px; background: url('images/logos/logo.svg'); } jquery $(document).ready(function(){ $(window).scroll(function(){ if($('body').scrolltop() > 100){

mongoose - How to manipulate/remove the sub-documents in MongoDB through MongooseJS? -

i have following schemas: //define suberschema var suberschema = new schema({ _id: { type: schema.types.objectid, required: true }, constraints: [constraintschema] }); //define spaceinfoschema var spaceinfoschema = new schema({ spacename: string, subers: [suberschema], _id: { type: schema.types.objectid, required: true } }); i want manipulate/get subdocs when use following code, operates parentdocs. this returns array subers. should suber specified id? spaceinfomodel.find({"_id": spaceid,"subers._id": userid}, "subers", callback); this removes whole document. should remove suber specified id? spaceinfomodel.remove({"_id": spaceid,"subers._id": userid}, callback); thanks in advance. find() return documents collection called on. in example spaceinfomodel . query: spaceinfomodel.find({"_id": spaceid,"subers._id": userid}, "subers&qu

java - Checkbox in the popupMenu -

i have popupmenu , checkbox. need make write status checkbox boolean. code not working: menuitem fast_result; boolean fast=false; @override public boolean onoptionsitemselected(menuitem item) { int id = item.getitemid(); switch (id) { case r.id.fastresult: fast_result = item.getsubmenu().getitem(r.id.fastresult);//this 182 line fast_result.setchecked(!fast_result.ischecked()); fast=fast_result.ischecked(); return true; } } it errors: fatal exception: main java.lang.nullpointerexception @ com.alexvsalex.helpformath.rootsactivity.onoptionsitemselected(rootsactivity.java:182) @ android.app.activity.onmenuitemselected(activity.java:2502) @ com.android.internal.policy.impl.phonewindow.onmenuitemselected(phonewindow.java:950) @ com.android.internal.view.menu.menubuilder.dispatchmenuitemselected(menubuilder.java:735) @

Excel Formula calculates in one cell but not another -

i have formula in excel that's returning #n/a in 1 cell. however, if go cell , enter same formula calculating properly. know might causing this? did fixate cells should stay? can adding "$" in front of row and/or column $a$1 stays on a1 when dragging/copying cell. a$1 stays on first column, $a1 stays on first row. maybe 1 of cells refers empty cell?

.htaccess - Activate save-as or open pop-up box for video files -

in .htaccess did manage activate pop-up box save-as , open options file download, files being images, jpg, jpeg, png etc. works perfectly. here code: <ifmodule mod_headers.c> <filesmatch "\.jpg$"> header append content-disposition "attachment;" </filesmatch> <filesmatch "\.jpeg$"> header append content-disposition "attachment;" </filesmatch> <filesmatch "\.png$"> header append content-disposition "attachment;" </filesmatch> <filesmatch "\.ogv$"> header append content-disposition "attachment;" </filesmatch> <filesmatch "\.mov$"> header append content-disposition "attachment;" </filesmatch> <filesmatch "\.avi$"> header append content-disposition "attachment;" </filesmatch> <filesmatch "

php - How can I check if a value already exists in mySQL database? -

i want store name in mysql database. when click submit button, php should check if name exists in database. if yes not submit , print error message: name exists in database. <?php if ( !empty($_post)) { $name = $_post['name']; $valid = true; if ($valid) { $pdo = database::connect(); $pdo->setattribute(pdo::attr_errmode, pdo::errmode_exception); $sql = "insert people (name) values(?) "; $q = $pdo->prepare($sql); $q->execute(array($name)); } } ?> <form action="form.php" method="post"> <input name="name" type="text" value="<?php echo !empty($name)?$name:'';?>"> <button type="submit" >submit</button> </form> try following query check if val

virtualbox - Can't play back .wav file I encoded and decoded with opus_demo -

i downloaded opus codec git repo , ran ./autogen.sh , ./configure , make , , encoded sample file opus examples page ./opus_demo -e voip 48000 1 8000 -cbr -bandwidth nb -complexity 0 -forcemono speech_orig.wav speech_encoded.bit . i tried decode ./opus_demo -d 48000 1 speech_encoded.bit speech_48khz.wav . when try play vlc, doesn't play (it shows playing less second no sound/feedback). i running ubuntu 14.04 32-bit on virtual machine (virtualbox). link found remotely related problem this , relates else opus_demo file. this output opus_demo shell commands: $ ./opus_demo -e voip 48000 1 8000 -cbr -bandwidth nb -complexity 0 -forcemono speech_orig.wav speech_encoded.bit libopus 1.1.1-beta-38-gfc0276f encoding 48000 hz input @ 8.000 kb/s in narrowband 960-sample frames. average bitrate: 8.000 kb/s maximum bitrate: 8.000 kb/s active bitrate: 8.000 kb/s bitrate standard deviation: 0.000 kb/s $ ./opus_demo -d 48000 1 speech_encode

java - ClassNotFoundException when handling PDF files using iText in Jdeveloper -

i need in solving following error java.lang.classnotfoundexception: com.itextpdf.text.documentexception which produced running simple void method show pdf file in jdeveloper. added itext jar file in libraries , version having 5.5.6. if writing simple pdf, method executed. when use below code, generates error. code is: public class pdf { private streamedcontent streamedcontent; private static final long serialversionuid = 1l; @postconstruct public void createpdf() throws documentexception, ioexception { try{ document document = new document(pagesize.a4, 50, 50, 50, 50); outputstream out = new bytearrayoutputstream(); pdfwriter writer = pdfwriter.getinstance(document, out); document.open(); pdfptable table = new pdfptable(1); pdfpcell cell = new pdfpcell(new phrase("\u0627\u0644\u0633\u0644\u064a\u0637\u064a")); cell.setborder(rectangle.no_border); cell.setrundirection(p

r - How can I extract the month using sqldf package -

i tried view based on group of date using sqldf package , month function got error : error in sqlitesendquery(con, statement, bind.data) : error in statement: no such function: month here query: s<-sqldf("select month(datetime),sum(wolfs) group datetime") attached toy data frame: df <- read.table(text = "datetime birds wolfs snakes 2014-05-21 9 7 2014-04-28 8 4 b 2014-04-13 2 8 c 2014-03-12 2 3 2014-02-04 8 3 2014-02-29 1 2 2014-01-17 7 1 b 2014-01-16 1 5 c 2014-09-20 9 7 c 2014-08-21 8 7 c ",header = true) h

Python loop through lists and append according to conditions -

i have 3 lengthy lists (of length 15,000). lets example 3 lists are: a b c 0 2 3 0 4 5 0 3 3 1 2 6 1 3 5 0 2 7 1 8 8 i values of b , c corresponding index of 0. example if a[i] == 0 add b[i] listb_0 , c[i] listc_0 . i tried listb_0 = [] listc_0 = [] a,b,c in zip(a,b,c): if == 0: listb_0.append(b) listc_0.append(c) but seems put python through never ending loop, after 5 minutes, see program still running. what want is, example listb , listc lista = 0 be listb_0 = [2,4,3,2] listc_0 = [3,5,3,7] what correct way achieve this? brobin pointed out in comment: instead of b or c , whole lists b or c appended. this should work: a = [0, 0, 0, 1, 1, 0, 1] b = [2, 4, 3, 2, 3, 2, 8] c = [3, 5, 3, 6, 5, 7, 8] listb_0 = [] listc_0 = [] a, b, c in zip(a,b,c): if == 0: listb_0.append(b) listc_0.append(c) print listb_0 print listc_0 >>> [2, 4, 3, 2] [3, 5, 3, 7]

c# - Why does csc2.exe exit with an error code with the use of the dynamic keyword? -

public void searchapps(string query, object callback) { dynamic callbackfunc = callback; threadmanager.querygamesasync(query, mainform.portal, log, (list) => { string[] strlist = new string[list.length]; for(int = 0; < strlist.length; i++) { strlist[i] = list[i].uid; } string data = json.serialize(strlist); callbackfunc(data); }); } this method causes csc2.exe exit code 1 can't compile it. idea what's wrong ? method part of scriptingobject of browser control. that's why callback dynamic. i had reference "microsoft.csharp" in order use dynamic.

mouseevent - Jquery mouseenter and mouseout -

i have div (div1) warps literal. on mouseenter put div (div2) in front of div1 , on mouseout hide div2. problem on mouseenter or hover, flashing. this code $(".edittext").mouseenter(function () { debugger; $("#divedit").css("display", "block"); $("#divedit").css("height", $(this).height() ); $("#divedit").css("width", $(this).width() ); $("#divedit").css({ "position": "absolute", "top": $(this).offset().top, "left": $(this).offset().left }); }).mouseout(function () { $("#divedit").css("display", "none"); }); }); if dynamically place items under mouse trigger mouseout events on (all?) browsers has left previous div , entered child. you can make div added transparent mouse using pointer-events style on added ele

javascript - Component doesn't resolve injection of $scope (angular 1.3.16) -

i have encountered weird error. i'm working on project we're using john papa's angularjs styleguide. i have following component-file, my-profile.component.js , attached app.mymodule my-profile.component.js (function() { 'use strict'; angular .module('app.mymodule') .component('myprofile', { }) .controller('myprofilecontroller', myprofilecontroller); /*@nginject*/ function myprofilecontroller($scope) { ... } })(); the component rendered using in view file. app.mymodule defined in mymodule.module.js mymodule.module.js (function () { 'use strict'; angular .module('app.mymodule', []); })(); and app defined in app.modules.js , app.mymodule set app dependency app.modules.js (function() { 'use strict'; angular .module('app', [ ... 'app.mymodule' ]); })(); m

c# - How can I pass an input/Textbox Field to Controller? ASP.NET MVC and Entity Framework -

Image
i've form , simple model following input fields: public class order { public int id { get; set; } public datetime orderdate { get; set; } public string article { get; set; } public double price { get; set; } public string notice { get; set; } } my form looks this i can catch values on controller [httppost] [validateantiforgerytoken] public actionresult create([bind(include = "orderid,orderdate,article,price,notice")] order order) { if (modelstate.isvalid) { db.orders.add(order); db.savechanges(); return redirecttoaction("index"); } return view(order); } so. want add dynamic fields jquery. works fine don't know how values multiple input fields. , that's problem. so want create each order entity. (how in last image) please take @ last image that's result want have! how can resulut in

c# - Showing a Windows form on a secondary monitor? -

i'm trying set windows form on secondary monitor, follows: private void button1_click(object sender, eventargs e) { matrixview n = new matrixview(); screen[] screens = screen.allscreens; setformlocation(n, screens[1]); n.show(); } private void setformlocation(form form, screen screen) { // first method rectangle bounds = screen.bounds; form.setbounds(bounds.x, bounds.y, bounds.width, bounds.height); // second method //point location = screen.bounds.location; //size size = screen.bounds.size; //form.left = location.x; //form.top = location.y; //form.width = size.width; //form.height = size.height; } the properties of bounds seem correct, in both methods i've tried, maximizes form on primary monitor. ideas? try setting windowstartuplocation parameter "manual" inside setformlocation method.

output as per requirement in sql code -

input: '1,2,4,5,c1,c2,c5,c7,c8,c9,t1,t5,t6,t10' output: 1-2,4-5,c1-c2,c5,c7-c9,t1,t5-t6,t10 here when give input like, comma separated string of different series output should each series hyphen , separated comma output should not in table format. --exec sequenceseriesreplacebyhyphen '1,2,3,11,12,13,15,16,20,21,22,c 1,c 2,c 3,c 5,c 6,c 9,72,73,t 1,t 2,t 5,t 99,55,56,57,60,61,v6,v7,v9,99,100,101' alter procedure dbo.sequenceseriesreplacebyhyphen @strinputlist varchar(max)-- inputstring begin create table dbo.#tempchar(value varchar(10)) insert #tempchar select value dbo.split2(@strinputlist) --where value '%[^0-9]%'; ;with ctesplit(letter, number) as( select ltrim(rtrim(left(value, patindex('%[0-9]%', value) -1))), cast(right(value, len(value) - patindex('%[0-9]%', value) + 1) int) #tempchar ) ,cte ( select *,rn = number - row_number() over(

h.264 - Pure C-Code of x264 of ffmpeg -

i doing hardware implementation on ratecontrol of ffmpeg. using x264 encoder, here not able find c-code implementation of function intra_mbcmp_x3_8x8c . i tried trace wards, there assembly implementation of code. can body please guide pure c-implementation of latest x264. it helpful, if helps me in disabling x86 flags in ffmpeg, able run pure c implementation. note:i have checked similar question here . not able answer. you're looking this . there's various implementations of mbcmp (sad, satd) because x264 allows user selection of error metric use. oh, , related second question, @ x264 --asm option (or if intend use api, see how it's implemented on api side): $ ~/projects/x264/x86-64/x264 --fullhelp|grep -- --asm --asm <integer> override cpu detection

python - Use Alembic to upgrade in-memory sqlite3 database -

i have flask app created app factory. when testing pytest, want use in-memory sqlite database because faster using temporary files. i'm using flask-migrate integrate alembic , flask-sqlalchemy. flask-migrate uses command line commands manage database. how can run migrations set database within test code? config.py : class defaultconfig(object): debug = true testing = true csrf_enabled = true secret_key = 'this-really-needs-to-change' sqlalchemy_database_uri = 'sqlite://' __init__.py : db = sqlalchemy() socketio = socketio() migrate = migrate() def create_app(config=none): app = flask(__name__) if config not none: config_path = os.path.abspath(config) app.config.from_pyfile(config_path) elif os.path.isfile(os.path.abspath(configfile)): app.config.from_pyfile(os.path.abspath(configfile)) else: app.config.from_object(defaultconfig) db.init_app(app) socketio.init_app(app)

c++ - Visual Studio 2010 Express couldn't compile code with cross reference -

gcc can compile code below vs2010 express couldn't: #include <iostream> #include <queue> using namespace std; struct { deque<a>::iterator next; }; int main() { a; } error message: error c2027: use of undefined type 'a' main.cpp(6) : see declaration of 'a' main.cpp(7) : see reference class template instantiation 'std::deque<_ty>' being compiled 1> 1> [ 1> _ty=a 1> ] is there way solve problem except using pointers? as discussed example in how come can use forward-declared class in std::vector? , instantiating standard containers incomplete types undefined behaviour. able access iterator type of std::deque<a> , required instantiate class, program give has undefined behaviour. in specific instance, in gcc undefined behaviour happens expect, while visual studio (with dinkumware standard library implementation) happens fail compile. visual studio behaves different in debug , release mode, in

linux - Problems installing ubuntu on windows machine -

Image
i trying install ubuntu 14.04.2 lte. have lunovo ideapad windows 8. have followed necessary steps flawlessly, , factory reset laptop make smoother. error when trying boot , install ubuntu. if try run ubuntu without installing. tried re-downloading ubuntu, , remounting on usb universal usb installer. is error due computer, or ubs/unbuntu? there option in boot menu. check disk error. not know if checking disk in iso disk or hard drive, ubuntu lunch screen appeared , looking ubuntu files (on usb), when done said there 2 errors. did not kind or if repaired , or how repair it. gave me option exit, lunovo boot screen appeared , stayed in attempting repair loop quite awhile gave on , shut down. i ask in ask ubuntu, not have enough "respect points" upload image. major respect can me out, have been ubuntu 2 days now, , hit dead end. this error message can appears in cases: 1. hardware not compatible, acpi issue. try boot additional options: "noapic" and/

javascript - Phonegap plugin - module.exports -

how objects passed between plugin's javascript , javascript of view? i'm playing around example code "apache cordova 3 programming" book , i'm stuck... in plugin.xml set namespace "mool" <js-module src="plugin.js" name="moool"> <clobbers target="mool" /> </js-module> plugin.js var mol = { calculatemol : function() { return 42; } }; var molll = { calculatemolll : function() { return 42222; } }; module.exports = molll; module.exports = mol; index.html <!doctype html> <html> <head> <title>meaning of life demo</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width;" /> <script type="text/javascript" charset="utf-8"

jquery - carouFredSel is not a function -

i'm struggling set caroufredsel. i'm doing correctly - links work. i'm adding on online store using smarty templates. error in chrome console: uncaught typeerror: jquery(...).caroufredsel not function head section of header.tpl : <!-- jquery --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js" type="text/javascript"></script> <!-- caroufredsel --> <script src="http://example.com/js/jquery.caroufredsel-6.2.1.js" type="text/javascript"></script> {literal} <script type="text/javascript"> jquery(function() { jquery('#carousel').caroufredsel({ items : 2, direction : "up", scroll : { items : 1, easing : "elastic", duration : 1000,

how to handle bytestream data in c socket -

void *rtp_rec() { memset(rtpbuf, 0, sizeof(rtpbuf)); unsigned char rtpbuf[2024]=""; while(1) { receive = recvfrom(sock1, rtpbuf,sizeof(rtpbuf) ,0,(struct sockaddr*)&serverrtp,(socklen_t*)&sizeof(serverrtp);); n = sendto(sock2,rtpbuf,strlen(rtpbuf),0,(struct sockaddr *)&sendtoother,sizeof(sendtoother)); } return 0; } //////////////////////////////////////////////////////////////////////////// i receiving 180 byte data packet continuosly (byte byte) in rtpbuf(buffer) using recvfrom() on socket (sock1). and want send same data packet of 180 byte socket (sock2) using sendto() . but sendto() function sending 1 byte data packet, recvfrom() receving data byte byte. please suggest logic. you need check value of recvfrom() make sure there no error, , ensure received proper number of bytes. also, want send many bytes you're receiving rather using strlen(rtpbuf) in case have null bytes in received data.

plsql - SELECT Statement within IF statement -

i different result select statement when parameter 0, 1 or 2. not skilled in plsql not sure if code give expected result. if run code "sql statement ignored" on line 3. begin if (:partype = 1) select * x to_date(date) >= (select to_date(sysdate)from dnv.dual) else select * x to_date(date) <= (select to_date(sysdate)from dnv.dual) end if; end; this example of select statement. later statement become longer , more complex think shows results trying get. below copy of entire code because not allowed show has become unreadable: begin if (:partype = 1) select table1.column1 , table1.column2 , table1.column3 , table1.column4 , table1.column5 , table1.column6 , table1.column7 , table1.column8 , table1.column9 , table1.column10 , table1.column11 , table1.column12 , (select table2.columnx x2 table2 somthing) "something" x1 table1 to_d

twitter bootstrap - !important css is not overriding the property in firefox -

it works fine in safari , chrome <nav class="navbar navbar-fixed-bottom navbar-inverse navbar-offcanvas navbar-offcanvas-touch" role="navigation" id="js-bootstrap-offcanvas" style="height:200px !important;"> </nav> but takes height 888px in firefox <nav class="navbar navbar-fixed-bottom navbar-inverse navbar-offcanvas navbar-offcanvas-touch" role="navigation" id="js-bootstrap-offcanvas" style="height:888px"> </nav> so how override i can't simulate situation testing think might fix problem or further diagnose issue. change inline style javascript after document loads , parses. window.onload = function() { window.settimeout(function(){ document.getelementbyid('js-bootstrap-offcanvas').style.height = '200px'; },100); }; please tell me happens. hope helps ;)

internet explorer - Google map iframe code not working in IE9 browser -

i added google map iframe code in 1 project , map did not display in ie9 browser. working fine in other browsers. i added iframe code listed below <iframe src="https://www.google.com/maps/embed?pb=!1m14!1m12!1m3!1d121059.0344739699!2d73.86296739999999!3d18.52461645!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!5e0!3m2!1sen!2sin!4v1435308748810" frameborder="0" style="border:0" allowfullscreen style="width:100"> </iframe>

php - Reference .phar classes installed globally with composer -

i've created small command line tool in php , i've packed phar archive. next thing did publish archive packagist.org aka composer . i can install phar package through composer so: composer global require acme/mypackage this installs package fine. , i'm able run through command well. so far good, here comes problem i´m facing. i have project should use acme/mypackage . want project reference class packed phar. this: <?php class someclass extends acmeclass { } the problem php code doesn't recognize acmeclass class. makes sense, because it´s "globally" installed somewhere on system. how other libraries solve issue? if i'm not mistaken phpunit similar right? how can solve issue? you'll need add composer.json file root of project: the first (and only) thing specify in composer.json require key. you're telling composer packages project depends on. { "require": { "monolog/monolog&

How to call a C# Class from a C# Form -

this class: using system; using system.collections.generic; using system.text; namespace num2wrd { public class numbertoenglish { public string changenumerictowords(double numb) { string num = numb.tostring(); return changetowords(num, false); } public string changecurrencytowords(string numb) { return changetowords(numb, true); } public string changenumerictowords(string numb) { return changetowords(numb, false); } public string changecurrencytowords(double numb) { return changetowords(numb.tostring(), true); } private string changetowords(string numb, bool iscurrency) { string val = "", wholeno = numb, points = "", andstr = "", pointstr = ""; string endstr = (iscurrency) ? ("only") : (""); try { int decimalplace = numb.indexof("."); if (decimalplace >

Search for email subject in outlook from excel using vba? -

i trying search email specific subject in outlook excel using following macro: sub work_with_outlook() set olapp = createobject("outlook.application") dim olns outlook.namespace dim fldr outlook.mapifolder dim olmail variant dim sir() string set olapp = new outlook.application set olns = olapp.getnamespace("mapi") set fldr = olns.getdefaultfolder(olfolderinbox) set mytasks = fldr.items set olmail = mytasks.find("[subject] = ""*desired subject*""") if not (olmail nothing) sir = split(olmail.body, vbcrlf) = 1 ubound(sir) activeworkbook.sheets("sheet1").cells(i, 1).value = sir(i) next olmail.delete end if end sub my problem error in excel saying user defined type not defined on line: dim olns outlook.namespace please can show me going wrong? thanks, you need add reference outlook in vba project. in vba editor menu bar click tools -> ref

java - LWJGL 3 : GLFW Inputs don't work -

i'm starting new project on lwjgl 3 , i've tested example project here : http://www.lwjgl.org/guide . i've set project, added library, natives... , when launched program worked fine except input didn't respond. (the window should close when press esc.) tried possibilities of handling input didn't work in case... thank in advance help.

angularjs - Why can't I pass $scope and $router in controller params? -

(function() { function appcontroller($router) { $router.config([ {path: '/courses',component: 'courses'}, {path: '/',component: 'welcome'} ]); } angular.module('mainapp', ['ngnewrouter']) .controller('maincontroller', ['$router', 'courserepository', appcontroller, '$scope', function($scope) { $scope.$on('clicked', function(e){ $scope.tgstate = !$scope.tgstate; }) }]); })(); i trying connect new angular route in 1 controller function wrote. works if in 2 separate controllers, somehow doesn't when i'm trying connect in 1 controller. apart confusing use of same name (are trying merge 2 functions? mean "connecting them"? can't in js, see below), you're instantiating wrong. this: .controller('appcontroller', ['$router', 'co