Posts

Showing posts from June, 2015

sql - How to extract US zip codes and check range -

i have table of addresses postal codes , canada. in our system assign territories based on zip code ranges need extract addresses , check whether within given range. tables this: key postalcode --------------------------- 1 58230 2 49034-9731 3 98801 4 m5h 4e7 i run select statement select key, convert(int, left(ltrim(rtrim(postalcode)),5)) pcode table left(postalcode, 5) not '%[^0-9]%' and results return table expected. key postalcode -------------------------- 1 58230 2 49034 3 98801 i wrap alias , attempt check range. select key, pcode (select key, convert(int, left(ltrim(rtrim(postalcode)),5)) pcode table left(postalcode,5) not '%[^0-9]%') x x.pcode between 58000 , 59000 sql server 2008 returns error msg 245, level 16, state 1, line 1 convers

c++ - Sorting vector of instances -

i taking coding class @ university , have specific requirements homework assignments. for week have class called npt represents nobel prize winner. class contains, amongst other things, name, year of prize , field of winner. now should make class, nobelpreise , contains container instances of said nobel prize winner class. supposed sort elements of container year of nobel prize. i wasn't able use std::sort function custom comparator correctly. code looks like: class nobelpreise { private: int numb; vector<npt> xx; public: nobelpreise(){numb=0;} void add(npt &n1){xx.push_back(n1);numb++;return;} npt get_nobel(int i) {return xx[i];} vector<npt> get_xx() {return xx;} int get_numb(){return numb;} ~nobelpreise(){} bool mycomp(npt n1, npt n2) {return (n1.get_jverl()<n2.get_jverl());} }; the method get_jverl() comes npt class , returns year. now sort function gives error saying that: sort(npl.get_xx().begin(), npl.get_xx().end(), npl

xml - Android ignoring weight parameter on custom row -

Image
i have following xml build custom row listview. it's working fine, status next address being word wrapped don't want. in past i've set weight , it's been fine, doesn't seem playing ball here. here looks like: heres happens on phone: heres xml: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/linearlayout1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/listviewonclick" android:orientation="vertical" android:padding="@dimen/padding" > <linearlayout android:id="@+id/linhoz" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="10" > <textview android:

c - What is wrong with my code?It is crashing everytime i run it -

i tried write code implement , print linked list using loop.but code giving runtime error. crashing when run it. #include <stdio.h> #include <stdlib.h> struct node { int info; struct node *next; struct node *prev; }var; int main() { struct node head; head.prev=null; struct node *temp; int i; for(i=1;i<5;i++) { struct node *new=malloc(sizeof(var)); temp->info=i; temp->next=new; new->prev=temp; temp=new; } for(i=1;i<=5;i++) { printf("%d ",temp->info); } return 0; } first have initialize head.next as head.prev : head.info = 0; head.prev=null; head.next=null; you have initializeyour pointer temp too. pointer should refer head @ start: struct node *temp = &head; adapt loop this: for( int i=1;i<5;i++) { temp->next = malloc(sizeof(var)); // allocat new nod right on target temp->next->info=i; // set data on

Convert XBMC Database Schema 4.0a in sqlite to mysql -

i use database schema of xbmc webapplication. can see schema here : http://wiki.xbmc.org/index.php?title=database_schema_4.0/a in server, have mysql database, test convert sqlite mysql firefox plugin : https://addons.mozilla.org/en-us/firefox/addon/sqlite-manager/ i add first table (2.1 table: profile) no problem. add seconde table (2.2 table: collection) have syntax error foreign. [ near "foreign": syntax error ]exception name: ns_error_failureexception message: component returned failure code: 0x80004005 (ns_error_failure) [mozistorageconnection.createstatement] i don't know syntax foreign key. can me? it looks there problem schema generated via firefox plugin. try using sqlite professional export sqlite database mysql. open database in sqlite professional, , choose data -> export -> mysql. create script can run on mysql database populate it. here promo code free copy of sqlite professional: y6e3m4h34apr

html - Make a DIV responsive in a non-responsive site. -

i have div in non-responsive site contains ad 120x600 pixels. want make div float @ right of screen. desktop or large devices ok when in smaller device site non responsive when site loads div become small. if site responsive in device of width 400px cover portions of screen. need in non-responsive site. ads higher click through rate. example div - <div id="float_rightad" style="position:fixed; top:15%; right:0;width: 160px; height:600px; z-index:5000;"> <div style="position:absolute; left:-5px; margin-top:0px; z-index:15;"> <a href="javascript:void(0);" onclick="document.getelementbyid('float_rightad').style.display='none'"><img src="http://secretdiarybd.com/wp-content/uploads/2015/05/close.gif.png" alt="close" height="20"></img> </a> </div> <div> <script data-cfasync="false" type="te

ios - blacklist characters are not ignored by Tesseract OCR -

i using tessearct ocr recognizing charcters of image. want numeric characters ignored ocr using _tesseract->setvariable("tessedit_char_blacklist", "0123456789"); by way ocr doesn't recognize numeric charactes provides me others characters in place of them don't want. as example : there image has text usd 12 , when apply ocr on image provides me usd fl as can see above ocr converted 12 fl don't want . want 12 ignored ocr. is there way result usd not usd fl provide me solution that. appreciable. see comment method setvariable() : // variables, wise set them before calling init. i had same issue , moving code before init fixed : tess = new tessbaseapi(); tess->setvariable("tessedit_char_whitelist", "0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); tess->simpleinit([datapath cstringusingencoding:nsutf8stringencoding], "eng", false);

javascript - Steps to build a web app connected to SQL server -

first time asking question here , feel noob asking figured might helpful info here. work data analyst creating reports in tableau , working sql server. i've had minimal experience programming in java, javascript, , html. d3 has peaked interest powerful language used create more complex/creative dashboards. use d3 , javascript create dashboards based off data housed on sql server having never built web app i'm little overwhelmed @ need accomplish such feat. know need api etc, i'm not sure of steps needed make happen. can explain me need (step step) "birds eye view", have idea of direction need go in? thanks. pick programming language (e.g. java or javascript). pick web server can run server side code written in language on (e.g. tomcat or node.js). find library programming language can interact sql server using. write server side program (in language of choice) can: read data http request. use query database. return data (probably formatted jso

cordova - MeteorJS Mobile build : rooturl is always 10.0.2.2:3000 instead of the real server specified during build script -

since few days have problem meteorjs , mobile build. problem occurs 3 differents apps. i build application np scripting , kind of script : #!/usr/bin/env bash if [ -z "$npm_package_config_mongourl" ]; echo "no mongourl config found in package.json"; else echo "set mongourl" && export mongo_url=$npm_package_config_mongourl; fi if [ -z "$npm_package_config_mongooplogurl" ]; echo "no mongooplogurl config found in package.json"; else echo "set mongooplogurl" && export mongo_oplog_url=$npm_package_config_mongooplogurl; fi if [ -z "$npm_package_config_mailurl" ]; echo "no mailurl config found in package.json"; else echo "set mailurl" && export mail_url=$npm_package_config_mailurl; fi if [ -z "$npm_package_config_rooturl" ]; echo "no rooturl config found in package.json"; else echo "set rooturl" && export root_url=$npm_package_config_

xaml - Using EventToCommand spoils DesignView in Visual Studio 2015 -

i'm using latest visual studio: microsoft visual studio professional 2015 version 14.0.24720.00 update 1 microsoft .net framework version 4.6.01038 when create new wpf project (targetframeworkversion: v4.5.2) , add mvvmlightlibs (latest version: 5.2.0.0) nuget inside following xaml <usercontrol x:class="mergeddirectoriestest.views.subview" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vm="clr-namespace:mergeddirectoriestest.viewmodels" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:command="http://www.galasoft.ch/mvvmlight"> ... <textbox style="{staticresource formtextboxstyle}" text="{binding lastname, updatesourcetrigger=propertychanged}"> <i:interaction.triggers> <i:eventtrigger eventname=&

javascript - Setting up and testing UI Router -

i'm trying use ncy-angular-breadcrumb, uses ui routes. have module set house ui routes: (function () { var app = angular.module('configurator.uiroutes', ['ui.router', 'ncy-angular-breadcrumb']); app.config(['$stateprovider', function ($stateprovider) { $stateprovider .state('home', { url: '/', ncybreadcrumb: { label: 'series' } }); }]); })(); i have test see if route works: describe('configurator ui routes', function () { beforeeach(module('configurator.uiroutes')); beforeeach(module('ui.router')); var $state, $rootscope, state = '/'; // inject , assign $state , $rootscope services. beforeeach(inject(function (_$state_, _$rootscope_) { $state = _$state_; $rootscope = _$rootscope_; })); //test whether url correct it('s

Exporting Android Library project with resource folder images -

i new android. using reusable code, convert jar file. using images jar source res folder. have accessed images " r.drawable.imagename " in library source. while converting library source jar, have export res folder. if using jar in android application, crashed . have followed link below convert library source jar. " http://www.cs.utexas.edu/~scottm/cs307/handouts/eclipse%20help/jarineclipse.htm ". where doing things wrong.? there procedure convert android library project jar resources .? or there wrong in accessing res folder image in android library source .? please help. update: the new gradle based build system supports "aar" files , apart compiled code, can contain resources etc well. old: resource packaging in library projects not supported android build tools. have provide separate zip res folder along jar file. code goes in jar (for library) or dex (for app). resources separately bundled apk file. hence sdk resourc

Android Error "Conversion to Dalvik format failed with error 2"? -

i using flurry sdk in application, before adding flurry jar file it's working fine out errors. after adding flurry jar file in libs folder getting error when compiling application in eclipse. trouble writing output: many methods: 70205; max 65536. package: 5 android.accessibilityservice 1 android.animation 2 android.annotation 315 android.app 136 android.content 28 android.content.pm 47 android.content.res 35 android.database 14 android.database.sqlite 8 android.gesture 113 android.graphics 44 android.graphics.drawable 1 android.graphics.drawable.shapes 11 android.location 27 android.media 40 android.net 1 android.net.http 1 android.net.wifi 96 android.os [2013-03-04 16:42:13 - myapp] conversion dalvik format failed error 2 i have idea how solve error 1 new error me unable solve. searched lot did't solution this. when remove jar file it's working fine. if has in libs not able run application. why getting error.? sollution this.. s

regex - Regexp for all text between two lines -

i match text that my begin line not useful text cannot match because don't know how composed end line i'd match text above, problem right cannot match text first line regext that: my begin line\n.*my end line so confused, ? to print lines between 2 patterns, excluding lines containing patterns use: sed -n '/my begin line/,/my end line/ {/my begin line/n;/my end line/!p}' file

jqgrid - accessing the cells of the selected row in a jq grid from code behind -

i have jqgrid in aspx page , when user clicks on row of grid want cells of grid selected row in code behind. possible without using jquery..?? thanks -vishu. you need add onselectrow callback jqgrid definition. callback called every time when user select row. onselectrow callback receive id of selected row value of first parameter. inside of onselectrow callback can use $(this).jqgrid("getrowdata", id) object represent cells of selected row. names of properties of object same name properties of colmodel columns.

getstream io - Creating Feed Groups for a Post instead of for a User -

hi i've post model owner, , answer model answers post. how can use getstream.io create streams result in following: "julie, frank , 20 more answer post" ( you're post owner) "julie post new answer in post xxx " ( you're frank) feed groups per entity any feed type can used create feed groups entity in application. since default feed group of type flat created called 'user' can confusing, free create feed group type 'flat' post/group/or other entity in program can have own activity feed. aggregated feeds to achieve behavior have described above need use aggregated feed type. create feed group of type 'aggregated' described above. every time supplies answer question create activity verb "answer" on feed post. default aggregation rule aggregates time , verb id looks interested in aggregation based on verb id. when retrieve activities aggregated feed can render in format have described above.

python - Using openpyxl to copy from one workbook to another results in error when saving -

i trying append values 1 sheet row row new workbook. code works when run on small test file, when run on target file returns error when saving. here code: from openpyxl import load_workbook openpyxl import workbook wb = load_workbook(filename='rm activity-pricing report - 2014-05-31.xlsm',keep_vba=false, data_only=true) ws_ottawa = wb.get_sheet_by_name('ottawa') wb2 = workbook() ws2 = wb2.create_sheet() row in ws_ottawa.iter_rows(): ws2.append(row) wb2.save('new_big_file.xlsx') the output error in spyder (python 3.5) is: traceback (most recent call last): file "<ipython-input-22-171ffbcd4891>", line 1, in <module> runfile('z:/revenue management report/extractpromodata.py', wdir='z:/revenue management report') file "c:\anaconda3-64\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 699, in runfile execfile(filename, namespace) file "c:\anaconda3-64\lib\site-pack

Poll System in ASP.NET MVC -

i want display polling in section of page, have created these poco classes : public class polls { public int id { get; set; } public string question { get; set; } public bool active { get; set; } public ilist<polloptions> polloptions { get; set; } } public class polloptions { public int id { get; set; } public virtual polls polls { get; set; } public string answer { get; set; } public int votes { get; set; } } and have used below viewmodel : public class pollviewmodel { public int id { get; set; } public string question { get; set; } public string answer { get; set; } } then, passed model using above viewmodel view : public actionresult index() { var poll = p in db.polls join po in db.polloptions on p.id equals po.polls.id p.active == true select new pollviewmodel { id=p.id, question=p.question, answer=po.answer

javascript - validation is not correct when no elements type in the confirm password text box -

how check validation of password. in below when try type in password text field , if ignore confirm password text field, still can submitted. if type in confirm password text field it'll check password text field, whether inputs same or not. fiddle <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.js"></script> <link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/jquery.bootstrapvalidator/0.5.3/css/bootstrapvalidator.min.css"/> <script type="text/javascript" src="http://cdnjs.cloudfla

html - Div images alignment -

when resize browser-window images, arranged in div, don't align (left). this url of website; http://www.robinkleijnen.com/index.php i hope can me!! its height of 2nd image that's causing it, 1px smaller others when float left 3rd image cant go way over. increasing image height 174px others solves it.

redirect - iis7 url rewrite matching query string exactly -

trying create rule redirect http://www.mystore.com/product_info.php?products_id=3 http://www.mystore.com/product/widget-666 so far got following: <rule name="rewrite .php" stopprocessing="true"> <match url="^(.*)product_info\.php$" /> <conditions logicalgrouping="matchany"> <add input="{query_string}" pattern="products_id=3" /> <add input="{http_host}" pattern="(.*)mystore*" /> </conditions> <action type="redirect" url="/product/widget-666" appendquerystring="false" /> </rule> ... not match on products_id=3, if products_id=8 still redirects changed <conditions logicalgrouping="matchany"> to <conditions logicalgrouping="matchall">

backbone.js - Backbonejs -collection is not defined -

i'm getting collection not defined error in backbone. var categorylist = backbone.view.extend({ el:'#content', render: function() { var = this; var cats = new categories(); cats.fetch({ success: function(cats) { var template = _.template($('#category-list-template').html(), {cats: cats.models}); cats.each(function(it) { console.log(it.tojson()); }); that.$el.html(template); } }) } }); and in script i'm running each loop add data table, i'm getting 'cats not defined error'. <script type="text/template" id="category-list-template"> <table class="table striped"> <thead> <tr> <td>id</td> <td>name</td> </tr> </thead> <

csv - Error loading log file data into mysql using cvs format and python -

i trying take data log file in cvs format, open log file , inserting row row mysql. getting error this: error traceback (most recent call last): file "/users/alex/pycharmprojects/pa_reporting/padb_populate.py", line 26, in values (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)', row) file "/users/alex/anaconda/lib/python2.7/site-packages/mysqldb/cursors.py", line 187, in execute query = query % tuple([db.literal(item) item in args]) typeerror: not arguments converted during string formatting. import csv import mysqldb mydb = mysqldb.connect(host='192.168.56.103', user='user', passwd='pass', db='palogdb') cursor = mydb.cursor() csv_data = csv.reader(file('/tmp/palog_demodata-100.csv')) row in csv_data: cursor.execute('insert palogdb(receive_time,serial,type,subtype,col1,time_generated,src,dst,natsrc,natdst,rule,\ srcusr,dstusr,a

angular - Importing lodash into angular2 + typescript application -

i having hard time trying lodash modules imported. i've setup project using npm+gulp, , keep hitting same wall. i've tried regular lodash, lodash-es. the lodash npm package: (has index.js file in package root folder) import * _ 'lodash'; results in: error ts2307: cannot find module 'lodash'. the lodash-es npm package: (has defaut export in lodash.js package root folder) import * _ 'lodash-es/lodash'; results in: error ts2307: cannot find module 'lodash-es'. both gulp task , webstorm report same issue. funny fact, returns no error: import 'lodash-es/lodash'; ... of course there no "_" ... my tsconfig.json file: { "compileroptions": { "target": "es5", "module": "system", "moduleresolution": "node", "sourcemap": true, "emitdecoratormetadata": true, "experimentaldecorators

html - Mobile Safari multi select bug -

if found annoying bug on current (ios 9.2) mobile safari (first appearing since ios 7!) if using multi select fields on mobile safari - this: <select multiple> <option value="test1">test 1</option> <option value="test2">test 2</option> <option value="test3">test 3</option> </select> you have problems automatically selection! ios automatically selecting first option after opened select (without user interaction) - not show blue select "check". so if select second option, select tell 2 options selected (but highlighting 1 selected)... if close , open select again, ios automatically deselect first value - if repeat, selected again without user interaction. thats annoying system bug, breaking user experience! solution safari multi select bug , empty , disabled option tick related issue: <select multiple> <optgroup disabled hidden></optgroup&

excel - InStr(1, cell.Value, "-") doesn't seem to be working with Not -

i have conditional doesn't seem work. if not instr(1, cell.value, "-") 'do else 'do else end if where cell.value either numbers in spreadsheet dash: "6621-123", or without dash: "555321" the first if let's both through , else ignored. ideas why isn't working? instr returns 0 on no match (not -1 vba string indexes 1 based) , not 0 true ( -1 ); other possible values > 0 can returned. if instr(1, cell.value, "-") = 0 '// not present else '// present

win universal app - change the text color when hover on a Button in a UWP -

Image
i trying modify text color of button when mouse hover,from black color,i used style: <style x:key="buttonmenustyle" targettype="button"> <setter property="foreground" value="#393185"/> <setter property="template"> <setter.value> <controltemplate targettype="button"> <grid> <visualstatemanager.visualstategroups> <visualstategroup x:name="commonstates"> <visualstate x:name="normal"/> <visualstate x:name="pointerover"> <storyboard> <coloranimation duration="0" to="#393185" storyboard.targetproperty="(textblock.foreground).(solidcolorbrush.color

opencv - Accessing Mobile Phone Camera As Web Cam with c++ -

i need mobile camera webcam. need further process camera video opencv application. softwares available purpose lacks required documentation of api. (i mean how access phone camera interface) can give me advice scenario. in advance. i think, it's not matter of opencv. assume, application run on pc. have 2 options: attempt interface phone's camera using device-specific drivers. maybe of them support such feature. write application mobile, stream video through wifi, bluetooth or in way. write set of drivers, attempt retrieve video feed , provide os webcam. third option involves recording video on mobile , transferring pc, guess, it's not option.

What import do i need for inV() and hasID() in gremlin groovy (3.0.1-incubating) -

i'm trying property value of edge given source , dest vertex ids, , edge label. in gremlin terminal following worked: g.v("fromnodeid").oute("edgelabel").where(inv().hasid("tonodeid")).values("edgeprop") sadly, in groovy, inv() , hasid() aren't recognized, , can't find correct import work. here imports iv'e tried: import org.apache.commons.configuration.configuration; import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.graphtraversalsource import org.apache.tinkerpop.gremlin.process.* import org.apache.tinkerpop.gremlin.groovy.* import org.apache.tinkerpop.gremlin.groovy.function.* import org.apache.tinkerpop.gremlin.groovy.util.* import org.apache.tinkerpop.gremlin.pipes.filter.* import org.apache.tinkerpop.gremlin.structure.edge import org.apache.tinkerpop.gremlin.structure.vertex import org.apache.tinkerpop.gremlin.structure.edgetest; import org.apache.tinkerpop.gremlin.structure.graph i'll note

swift - Realm: Partially update -

i'm using realm in swift project , i'm having issues partially updating objects. the problem have object contains information server plus user generated informations. in case topic can either visible or hidden default, user can change visibility value. when launch app first time call server api fetch information create topic object: has visibility value undefined . user makes choice , set visibility value visible . the second time launch application fetch info again server , recreate topic . call realm method add:update: update object updates visibility property undefined again. i know there method create:value:update: means have create big dictionary values want update. model objects not small, in cases have lot of properties , dictionary huge. don't approach, complicated maintain. do have hint on how handle case this? a possibile way create object (table) has relationship topic , 1 property visibility not overridden when create topic again, soun

testing - Two questions about SQL based on an ERD diagram. (novice level) -

i've attached picture shows erd diagram these 2 questions apply to. the erd optometry doctors , patients. it's coursework i'm having trouble understanding these two. any sql savvy people out there willing me out corresponding sql statements? thank you. this erd 1. list of patient’s name , doctor treats patient, date of last eyetype result, last glasses type , brand, show these patients live either chicago or san diego. order date , inside on patient’s name a list shows per each brand of glasses total count of every patient wears corresponding brand. show results total amount of patients more 25. your sql query start, there few things aware of: how tables related? how can join them in query (how connect?)? in select statement, think it's asking 'glass type' rather 'eye type' select statement missing from, indicating tables you're selecting - add joins need make relate tables where clause looks good order missing date (th

javascript - Can I create HTML form fields with fixed positions using Orbeon forms? -

in orbeon forms, possible position input fields @ specific x, y location, relative background image? i have existing paper form covers complete page. want use scanned form image background , place input fields on background in specific locations. i know possible adobe acrobat, looking web-based open source alternative. currently using html forms using code following: <input name="current_user" id="current_user" type="text" class="noborder" style="position:absolute; left:90px; top:15px; width:270px; height:19px;" oscardb=current_user> the position:absolute; left:90px; top:15px; places input field @ specific location on background image. i can code these hand, gui tool field alignment tools , field properties. if not in orbeon, know of tool? plan b use gui form/field designer , write code generate required html forms code. orbeon forms isn't designed create exact replicas on we

java - Using external image as drawable resource -

so have image saved on external sd-card. now, want use image resource in project. (i want use image located @ specific path instead of r.drawable.image). it great, if there way kinda "add" image resources (and not use it), image gets resourceid ones in r.drawable got. but want display external image in imageview. first need read external storage permission <uses-permission android:name="android.permission.read_external_storage" /> then, string imagepath = environment.getexternalstoragedirectory().getabsolutepath() +"directoryname/imagename.png"; bitmap bitmap = bitmapfactory.decodefile(imagepath); imageview imageview = (imageview)findviewbyid(r.id.imageview); imageview.setimagebitmap(bitmap);

python 2.7 - Building Speech Dataset for LSTM binary classification -

i'm trying binary lstm classification using theano. have gone through example code want build own. i have small set of "hello" & "goodbye" recordings using. preprocess these extracting mfcc features them , saving these features in text file. have 20 speech files(10 each) , generating text file each word, 20 text files contains mfcc features. each file 13x56 matrix. my problem is: how use text file train lstm? i relatively new this. have gone through literature on not found understanding of concept. any simpler way using lstm's welcome. there many existing implementation example tensorflow implementation , kaldi-focused implementation scripts , better check them first. theano low-level, might try keras instead, described in tutorial . can run tutorial "as is" understand how things goes. then, need prepare dataset. need turn data sequences of data frames , every data frame in sequence need assign output label. keras s

c - pthread Return Values to an Array -

i working on project uses pthreads. project far starts user specified number of threads , work on each thread closes. each thread stored in dynamically allocated array of memory. using: threads = malloc(number_of_threads * sizeof(pthread_t)); then create each thread in for-loop: pthread_create(&(threads[i]), null, client_pipe_run, (void *) &param[i]); what need next store return values of these threads. understanding need pass pthread_join address of pointer want have return value stored in. little confused. i'm fine pointers point brain kind of has melt down haha. idea on how acheive i'm not confident correct: int *return_vals = malloc(sizeof(int) * number_of_threads); for(i = 0; i< number_of_threads; i++) { pthread_join(&(threads[i]),(void *) &(return_vals[i])); } then return value similar to: int val = *(return_val[0]); any on appreciated! note allocating memory threads this: threads = malloc(number_of_thread * sizeof(pthread

visual studio - C# Starting Template -

is there way can have template (of own choice) when open visual studio. know in c++ go c:\program files (x86)\microsoft visual studio 14.0\vc\vcprojectitem\newc++file , can open newc++file file , paste template there. i'm in college , our teachers wants have few lines @ start description of program our names etc, , don't want have copy paste/type in every time. yes, can create project template. create project. add/delete/modify files. go file → export template → export template , click project template , follow wizard. see msdn . and then, when create new project can select template. you can several way, in point of view, 1 easiest.

java - Maven - Jar inside a War -

Image
i'm converting old ant build maven project , maintain exact structure of resulting war file created using ant. here desired structure of war file. here structure of project before compiled , packaged. i'm having trouble figuring out how create jar of example.java , place folder called applet @ same level other folders web folder. can restructure project way have keep resulting war file's structure same. how create jar file , war file , place jar file inside war? note: i've been trying use example here, how create jar part of project packaged war , structure different i'm having trouble getting i'm after. p.s. i'm curious why set ant build way begin with. mean, point of having classes packed in jar , placed inside applet folder rather putting them in traditional place inside war would under web-inf/classes/java/com/example/*.class. the easiest move example.java own module jar packaging (i.e. sub project) , use maven dependency plugin

WCF server client async callback with object -

i have server , client. client call method on server, server in response have prepare dictionary , send client. operation might take time. should async. read instructions , examples. beginxxx , endxxx iasyncresult. if need server return dictionary of objects. how implement ? i thought when sending callback delegate can send signature of 1 of clients' functions delegate , when server finish invoke delegate proper dictionary data. 1) adding service reference in vs (or slsvcutil ) generates handy proxy code events silverlight projects. can use implement callback's pattern 'service/server agent' if want. can use code regular .net apps modifications. 2) vs .net project can generate proxy async methods. svcutil - too . 3) real long running operations can use wcf services callbacks (+ binding restrictions).

javascript - How to add an UpperCase function to each textbox in a dynamic table? -

i trying create dynamic table textboxes want textboxes converted upper case every time write. any ideas on how this?? currently how doing dynamic table: var n = 1; function addrow(tableid,nrocolumna) { var table = document.getelementbyid(tableid); var rowcount = table.rows.length; var row = table.insertrow(rowcount); for(i=0;i<nrocolumna;i++){ var cell = row.insertcell(i); var element = document.createelement("input"); element.type = "text"; element.name = n+"0"+i; element.size = "12"; element.id = n+"0"+i; //element.onkeyup = function(){alert()}; cell.appendchild(element); } n++; } i trying document.getelementbyid(element.id).value.touppercase() getting error null value element.id any appreciated! i tested code onkeyup function activated: var n = 1; function addrow(tableid,nrocolumna) { var table = document.getele

android - How whatsapp/Instagram or other compresses the image before uploading it to server? -

i used below method compress image before uploading server. to summarize below code, take image phone/sdcard, convert bitmap , carryout scaling , compression on bitmap. save compressed bitmap on disk image in new location. this method compress image 3mb - 5mb in 30-100kb. (when check compressed image size on sdcard) then send newly compressed image of 30-100kb upload on server converting bitmap string ( base64.encodetostring() ) i thought work fine. when check uploaded image on server, size of image same original image size (original size before compressed) instead of compressed 30-100kb size image. here code: public string compressimage(string imageuri) { string filepath = getrealpathfromuri(imageuri); bitmap scaledbitmap = null; bitmapfactory.options options = new bitmapfactory.options(); options.injustdecodebounds = true; bitmap bmp = bitmapfactory.decodefile(filepath, options); int actualheight = options.outheight; int actualwidth =

c++ - Multiple default gateways getting -

i have program in c++ getting default gateway , works okay until try on pc witch has few default gateways. here code: dword err,adapterinfosize =0; pip_adapter_info padapterinfo, padapt; if ((err = getadaptersinfo(null, &adapterinfosize)) != 0) { if (err != error_buffer_overflow){ std::cout<<"error s05\n"; cin.ignore(); } } if ((padapterinfo = (pip_adapter_info) globalalloc(gptr, adapterinfosize)) == null) { std::cout<<"error s06\n"; cin.ignore(); } if ((err = getadaptersinfo(padapterinfo, &adapterinfosize)) != 0) { std::cout<<"error s07\n"; cin.ignore(); } padapt = padapterinfo; while (padapt){ dfltgw = padapt->gatewaylist.ipaddress.string; break; } padapt = padapterinfo; cout << endl << "default gateway: " << dfltgw << endl; on pc have virtual netw

php - Is there a way to make set up reference transaction paypal's rest API -

i'm trying implement paypal using reference transactions, read nvp/soap api allows creating billing agreement , reference billing agreement id future payment requests. i want know if possible achieve using rest api. i know rest api allows create billing plans , agreements subscription plans, not need, need handle recurring payments on own, users can approve agreement on paypal when susbscribe on app , charge them periodically cron approved account on paypal. is possible? if can provide example of flow must follow? thanks. yes. load rest api reference , scroll down billing plans , agreements section. you'll find chapters "create agreement", "execute agreement", etc.

ios - Is a strong retain cycle a relevant consideration for a singleton class that should exist for the life of an app? -

i have singleton class in app created @ app launch , in use. going introduce nstimer calls 1 of singleton's methods periodically, understanding timer retain strong reference singleton class (since singleton class target). correct? more importantly, strong retain cycle problem singleton class should live duration of app? if so, why? i consider problem. singleton class hard refactor , reuse. adding retain cycle 1 going make class harder change or reuse in future. when discover need class (or @ least set of responsibilities timer part of) not singleton you'll need remember or identify memory leak , fix part of refactor. future sad. instead can write class follows patterns (for memory management , otherwise) regardless of if accessed singleton or not. in case might mean keeping weak reference timer (" note in particular run loops maintain strong references timers, don’t have maintain own strong reference timer after have added run loop. ") , invalidating ti

excel vba - Duplicate a template worksheet and populate from data table in another sheet -

i achieve following use template ("amorttemplate"), create new worksheet in same workbook once new sheet created ("amorttemplate (2)"), populate specific fields in worksheet table in existing worksheet ("assetinfo") in same workbook rename new worksheet ("amorttemplate (2)") value of specific field in new worksheet, e.g. "abc 123 gp", cell g7 in sheet repeat new sheet creation , field population using reference table in "assetinfo" worksheet until sheets created , fields populated records (rows) in reference table i have managed create simple vba macros (using macro record function in excel 2016) shown below, need combine actions , repeat described above. sub copy_amort_template() ' ' copy_amort_template macro ' sheets("amorttemplate").select sheets("amorttemplate").copy before:=sheets(2) end sub sub insert_asset_info() ' ' insert_asset_info macro ' shee