Posts

Showing posts from January, 2011

How to initialize google (opensocial) gadget of type="url"? -

given: <?xml version="1.0" encoding="utf-8" ?> <module> <moduleprefs title="gadget" scaling="false" height="550"> <require feature="setprefs"/> <require feature="minimessage"/> <require feature="dynamic-height"/> <require feature="views"/> <require feature="google.calendar-0.5"/> </moduleprefs> <content type="url" href="https://.../gadget" view="profile"/> </module> my question is: how initialize gadgets.* api here? gadgets of type="html" it's done automatically not "url". javascript library include? how use params passed via get?

php - Installing Slim 3 using Composer -

hello. please new php slim framework. have tried day download , install slim 3 through composer haven't been successful. am using windows pc. used command prompt , downloaded composer , installed composer desired directory. however, when try installing slim 3, error : "installation failed, reverting ./composer.json original content" [command prompt error message][command prompt error message] make sure have high enough version of php, , php in path. check - print "php -v " in command line (you can pretty sure run php7). make sure in right directory project. provide complete command line output, there things didn't know important answer. after all, can delete composer.json , composer.lock directory, , try again.

loops - snake game move issue [javascript] -

i'm kind of new in javascript , i'm trying make snake game, make snake move automatically snake.push , snake.shift(tail) , tried few things , failed, foor loop , add dy++ hy (but head moving). with code, head move , tail shifted, move once. how smart way make keep moving desired direction by adding , removing item multidimensional array ? var canvas = document.getelementbyid("mycanvas"); var ctx = canvas.getcontext("2d"); var snakesize=10; var snakelength = 5; var dist =2+snakesize; var dy=1; var direction = "up"; function game(){ ctx.clearrect(0,0,canvas.width,canvas.height); drawsnake() } function snakebody(x,y){ ctx.beginpath(); ctx.fillrect(x*(dist),y*(dist),snakesize,snakesize); ctx.fillstyle="red"; ctx.fill(); ctx.closepath();} function drawsnake(){ var snake = []; (var i=0;i<=snakelength;i++){ snake.push({x:i, y:canvas.height/dist/2}); } var hx = snake[snake.length-1].x var hy = snake...

Python pandas make new column from data in existing column and from another dataframe -

i have dataframe called 'mydata', , if do len(mydata.loc['2015-9-2']) it counts number of rows in mydata have date, , returns number like 1067 i have dataframe called 'yourdata' looks like timestamp 51 2015-06-22 52 2015-06-23 53 2015-06-24 54 2015-06-25 43 2015-07-13 now want use each date in yourdata instead of typing in each date len(mydata.loc['2015-9-2']) i can iterate through 'yourdata' using them like len(mydata.loc[yourdata['timestamp']]) and produce new dataframe results or add new column yourdata result each date, i'm lost how this? the following not work yourdata['result'] = len(mydata.loc[yourdata['timestamp']]) neither this yourdata['result'] = len(mydata.loc[yourdata.iloc[:,-3]]) this work yourdata['result'] = len(mydata.loc['2015-9-2']) buts no want use date in each row not fixed date. edit : first few rows of mydata tim...

C# Code Contracts with Builder Pattern - "Possibly calling a method on a null reference" -

i'm investigating code contracts , i'm implementing builder pattern this: public class personcaution { private personcaution() { } public string cautiontype { get; private set; } public string remarks { get; private set; } public class builder { private string _cautiontype; private string _remarks; public builder withcautiontype(string value) { contract.ensures(contract.result<builder>() != null); _cautiontype = value; return this; } public builder withremarks(string value) { contract.ensures(contract.result<builder>() != null); _remarks = value; return this; } public personcaution build() { contract.ensures(contract.result<personcaution>() != null); return new personcaution { cautiontype = _cautiontype...

asp.net - Best way to check SQLDataReader before reading -

i reading data db using sqldatareader. best way check, before reading data. 1 best out of 3 method 1 using (sqldatareader objreader = sqlcommand.executereader()) { if (objreader != null) { while (objreader.hasrows && objreader.read()) { //code } } } method 2 using (sqldatareader objreader = sqlcommand.executereader()) { if (objreader != null) { while (objreader.read()) { //code } } } method 3 using (sqldatareader objreader = sqlcommand.executereader()) { ...

sql server - T-SQL Update Record need to add condition which requires JOIN -

i have existing query updates specific values (represented col1, col2, col3 here) of records in table current values of cols defined source record in table. source record defined id foreign key in table (represented fkrecid here) declare @sourcerecordid varchar(50) set @sourcerecordid= n'{the id}' update dbo.targettable set [col1] = sourcedata.col1 ,[col2] = sourcedata.col2 ,[col3] = sourcedata.col3 ( select col1, col2, col3 targettable fkrecid = @sourcerecordid ) sourcedata ((fkrecid != @sourcerecordid) , (cast(targettable.col1 nvarchar(max)) != cast(sourcedata.col1 nvarchar(max)) or cast(targettable.col2 nvarchar(max)) != cast(sourcedata.col2 nvarchar(max)) or cast(targettable.col3 nvarchar(max)) != cast(sourcedata.col3 nvarchar(max)) ) go this updates other records in table using values defined in source record. however, need add further condition updates records same "type" source record. value of "type" held in table - (...

angular - Voice recognition (speech to text - STT cordova plugin) -

i'm looking speech recognition in ionic2 framework cordova plugin . if can implemented, gently provide example of code (.html , .ts)? i found this, ionic1: http://devgirl.org/2016/01/08/speaking-with-cordova/ , can't adapt code ionic2. i appreciate can provide, , sorry little english. source: https://github.com/macdonst/speechrecognitionplugin . using command line, add plugin ionic2 project: cd your_project_root_folder since ios 10 it's mandatory add nsmicrophoneusagedescription in info.plist access microphone. to add entry can pass microphone_usage_description variable on plugin install. ionic plugin add https://github.com/macdonst/speechrecognitionplugin --variable microphone_usage_description="your usage message" on ios 10 , greater uses native sfspeechrecognizer (same siri). on ios 9 , older uses ispeech sdk, api key required, 1 on https://www.ispeech.org/ , it's free. provide key, add preference inside config.xml <...

c# - How to print many graphical objects in a loop? -

i have print lot of barcodes. how can in loop, if use code block print single barcode: p.printpage += delegate(object sender1, printpageeventargs e1) { e1.graphics.drawstring("title", new font("univers 55", 6), new solidbrush(color.black), new rectanglef(titlex, titley, p.defaultpagesettings.printablearea.width, p.defaultpagesettings.printablearea.height)); e1.graphics.drawstring(s, new font("barcode", 24), new solidbrush(color.black), new rectanglef(codex, codey, p.defaultpagesettings.printablearea.width, p.defaultpagesettings.printablearea.height)); e1.graphics.drawstring(test, new font("univers 55", 8), new solidbrush(color.black), new rectanglef(numberx, numbery, p.defaultpagesettings.printablearea.width, p.defaultpagesettings.printablearea.height)); }; titlex , titley , codex , codey , numberx , numbery variables store position of 3 parts of each barcode object (title...

python - Django: One-to-many relation for [0, 1] cardinality -

imagine having 2 models: class service(models.model): key_service_name = models.foreignkey(key_service_type, related_name='service_key_service_names', null=false) service_hourly_wage_rate = models.decimalfield(max_digits=5, decimal_places=2, null=true) service_amount = models.decimalfield(max_digits=7, decimal_places=2, null=true) class serviceadditionalinfo(models.model): service = models.foreignkey(service, related_name='service_additional_info_services', null=false) fixed_price = models.decimalfield(max_digits=8, decimal_places=2, null=true) amongst other info, service class serializer features field description: service_additional_info = serviceadditionalinfoserializer(read_only = true, many=false, source = 'service_additional_info_services') in practice, 1 service instance may referenced 0 or 1 serviceadditionalinfo instance. serializer understandably returns list while prefer dictionary. my question: recommended way of modelling re...

php - Symfony docker configuration -

i trying build docker image run symfony3 app. i have docker-composer.yml , site.conf in docker-composer define 2 containers web , php , link these cntainers: web: image: nginx:latest ports: - "80:80" volumes: - ./code/test:/var/www/test - ./site.conf:/etc/nginx/conf.d/default.conf links: - php php: image: php:7-fpm volumes: - ./code/test:/var/www/test i found offical nginx docs on how set site.conf: my site.conf: server { server_name test-docker.local; root /code/test/web; location / { try_files $uri /app.php$is_args$args; } # dev location ~ ^/(app_dev|config)\.php(/|$) { fastcgi_split_path_info ^(.+\.php)(/.*)$; fastcgi_pass php:9000; include fastcgi_params; fastcgi_param script_filename $realpath_root$fastcgi_script_name; fastcgi_param document_root $realpath_root; } # prod location ~ ^/app\.php(/|$) { fastcgi_split...

git - Which output format of Libre Office can I use to track the history of my files? -

i thought of using fodt output format tracking history of files using git scm. but seems fodt quite verbose. example i generated file contains hello wordld! i changed text hello world. then checked diff. i found expected change: <text:p text:style-name="p1">hello world!</text:p> became <text:p text:style-name="p1">hello world.</text:p> besides there several more changes: <config:config-item config:name="viewleft" config:type="long">7239</config:config-item> became <config:config-item config:name="viewleft" config:type="long">7204</config:config-item> . <config:config-item config:name="rsid" config:type="int">555044</config:config-item> became: <config:config-item config:name="rsid" config:type="int">600727</config:config-item> and <office:meta> <meta:initial-creator>user name...

node.js - migrate python code to NodeJS -

i beginner in nodejs. have worked on scripts in python calculation on 2 csvs. there easy way migrate python script nodejs? don't know whether right way it. wanted know there way for it. any suggestions encouragable. if want convert code javascript there tools available transcrypt converts python code javascript.

javascript - WP LayerSlide counter -

Image
in wordpress how in layerslide put counter? here example counter tried use below: <p>team number <span id="lines">0</span> </p> $('#lines').animatenumber({ number: 165 }); ) i tried put code in here, doesn't work:

redhawksdr - Building REDHAWK CF from Source on Fedora24 -

i attempting build redhawk cf source on fedora24 machine. i've hit few barriers, , hoping folks can provide guidance on following 2 issues: 1) cloned redhawksdr/redhawk repository, , attempting build cf in redhawk.git/redhawk/core/src . f24 ships gcc6, , based on listed supported platforms (rhel / centos 6-series), i'm guessing bit ahead of upstream testing against. @ time of clone, core @ cfea23b tagged v2.0.1. in order build, i've had make 4 changes. latter 2 of them believe gcc6-required changes (i.e., gnu-c++14), think top 2 required regardless of c++ standard in use. said, these lines last touched in feb 2016 - hence concern. bet these have been caught if actual errors, leads me believe i'm doing wrong. my changeset below: diff --git a/src/control/framework/nodebooter.cpp b/src/control/framework/nodebooter.cpp index d79c291..dbd97ad 100644 --- a/src/control/framework/nodebooter.cpp +++ b/src/control/framework/nodebooter.cpp @@ -141,7 +141,7 @@ void l...

c++ - Run a command from Windows from Python code -

how can run following command python3 on windows 7 gcc main.cpp -o main.out ./main.out the purpose execute main.cpp file python3. look subprocess call import subprocess subprocess.run(["gcc", "main.cpp -o main.out"]) subprocess.run(["./main.out"]) should work. subprocess have more utilities usefull you.

python - django rest framework: order of decorators, auth classes, dispatch to be called -

very confused order of decorators, auth classes, dispatch called in djangorestframework. seems little different django framework knowledge. some codes: #operation_logger: customized decorator class fileview(apiview): parser_classes = (multipartparser,)#a authentication_classes = (basicauthentication,)#b @permission_classes((isauthenticated,))#c @method_decorator(csrf_exempt)#d @method_decorator(operation_logger)#e def dispatch(self, request, *args, **kwargs):#f return super(fileview, self).dispatch(request, *args, **kwargs) @method_decorator(operation_logger)#g def post(self, request):#h print "xxxxpost" what order of (a),b,c,d,e,f,g,h called when handling requests? seems b called after f before g , h? by way, @ beginning, project traditional django project. know request should go through middlewares. now, added new app, hosts apis drf. i not sure whether request apis go through middlewares or not? thanks ...

Angular 2 Routes - Cannot Match Any Routes RC4 -

i testing basic angular2 app , ran trouble routing. stripped have 2 test components. project rc4 , built angular cli. had nightmares last night...it seems should easy figure out can't see it. feel has app being in src folder? (app not 'root'?) thank help. error (from chrome dev) zone.js:461 unhandled promise rejection: cannot match routes: '' ; zone: angular ; task: promise.then ; value: error: cannot match routes: ''(…) zone.js:463 error: uncaught (in promise): error: cannot match routes: ''(…) edit ***** fixed fixed doing few things. (1) added default route routes array in app.routes.ts. project structure is src app test.component.ts test2.component.ts app.routes.ts app routes: import { providerouter, routerconfig } '@angular/router'; import {test2component} './test2.component'; import {testcomponent} './test.component'; const routes: routerconfig = [ { path: '', component: t...

eclipse - Java configure buildpath to navigate project -

Image
i'm trying navigate in project using ctrl + alt + h keys (open call hirearchy) in eclipse neon ide , sts ide. can not keep sailing in lower levels , see method members i saw in articles mentioned problem caused in buildpath any suggestion

function - python functools.partial with fixed array valued argument -

i'm trying vectorize following function on argument tiling : def find_tile(x,tiling): """ calculates index of closest element of 'tiling' 'x'. tiling: array of grid positions x: variable of same type elements of tiling """ return np.argmin(np.linalg.norm(tiling - x, axis=1)) for instance, non-vectorized version of function can accept following arguments tiling = np.array( [[i,j] in xrange(3) j in xrange(3)] ) x = np.array([1.2, 2.7]) i'm interested in finding fastest possible vectorisation, such x remains single vector , can pass list of arguments tiling so tried defining multiple tilings using generator: tilings = (tiling + np.random.uniform(0,1,2) j in xrange(3)) and using map , functools.partial : map(functools.partial(find_tile, x=x), tilings) apparently, there's problem x being array or something, since i'm getting error: traceback (most recent call last): file ...

ios - Set to public an implementation file (.m or .mm) inside framework -

Image
the same way header file can set public in target membership when creating framework, possible same thing implementation file? know it's not normal thing do: leaving implementation file public within framework. accelerate development process lot debugging. this set header file: while implementation file: is possible? if you're using objective-c, methods in implementation file private default. have no other choice expose these methods in public interface in header.

symfony - Symfony2 create new entity error: NotFoundException -

i getting notfoundhttpexception error when try create new entity form. this code creating form , entity - categorycontroller: /** * displays form create new category entity. * * @route("/new", name="category_new") * @method({"get"}) */ public function newaction(request $request) { $entity = new category(); $form = $this->createcreateform($entity); return array( 'entity' => $entity, 'form' => $form->createview(), ); } /** * creates new category entity. * * @route("/", name="category_create") * @method("post") * @template("adminbundle:categorypanel:new.html.twig") */ public function createaction(request $request) { $entity = new category(); $form = $this->createcreateform($entity); $form->handlerequest($request); if ($form->isvalid()) { $em = $this->getdoctrine()->getmanager(); $em-...

Properly changing HttpClient headers for different calls in C#? -

i'm writing program makes post , calls asynchronously. issue i'm running each post , have different headers/host parameters. i have httpclient initialized outside main() class , inside main class have following, client.defaultrequestheaders.add("host", "website1.com"); and get/post request want have website2 in host parameter, client.defaultrequestheaders.add("host", "website2.com"); but collide , it's throwing error because exists. what's proper way approach this? use sendasync instead of getasync or postasync var request = new httprequestmessage(httpmethod.get, new uri("http://targeturi.com")); request.headers.host = "website2.com" var response = await client.sendasync(request); you can add many headers want request before sending it

powershell - Error: Need to specify the physical directory for the virtual path 'Web/' of role -

Image
i'm following answer @ bottom of question here: asp.net 5 web application azure web role? trying build azure web role asp.net core. when run powershell script error: error cloudservices077: need specify physical directory virtual path 'web/' of role if knows way use azure web roles in asp.net core too. i'm using cspack try , configure this. powershell script: # path cspack $cspackpath = join-path $env:programfiles 'microsoft sdks\azure\.net sdk\v2.8\bin\cspack.exe' $packagepath = 'i:\users\myusername\documents\visual studio 2015\projects\soundvast\soundvast.azure\soundvast.cspkg' $servicedefinitionfile = 'i:\users\myusername\documents\visual studio 2015\projects\soundvast\soundvast.azure\servicedefinition.csdef' $webrolename = 'webrole1' $webrolepath = 'i:\users\myusername\documents\visual studio 2015\projects\soundvast\soundvast.azure' # define cspack parameters $cspackparameter = @( $servicedefinit...

regex - Nginx forward proxy with # in the url -

so trying forward url contains # , having difficulty. have following in location sections: location ~* /.%23/evl { proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_pass https://foo.com; } location ~* /(?!.%23/evl) { proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_pass http://bar.com; } i http://example.com/#/evl/ * goto foo.com everything else bar.com any appreciated.

How to extract line between 2 lines in c# -

i have text file content as: ************** text ************** i want read text between **** in c#. how can achieve same in c sharp you use readalltext contents of file, replace , trim remove unwanted contents of file: var result = system.io.file.readalltext(@"c:\path\to\file.txt") .replace("*", string.empty) // remove asterisks .trim(); // trim whitespace , newlines

datetime - Is there a way to get starting date of a given weekNo of a given year Java? -

this question has answer here: how first day of given week number in java 7 answers is there way using library this. datetime getstartingdate(string year, int weekno){ //should return starting day of given weekno of given year. } ex: year = 2016 weekno=1 datetime returning = 3rd jan in (sun-sat format) = 4th jan in (mon-sun format) it seems want, starting point, first full week starts on given day of week (sunday or monday in example). this achieved this: import static java.time.temporal.temporaladjusters.nextorsame; public static localdate getstartingdate(int year, int weekno, dayofweek weekstart) { //should check arguments valid etc. return year.of(year).atday(1).with(nextorsame(weekstart)).plusdays((weekno - 1) * 7); } or alternative: return year.of(year).atday(1).with(aligned_week_of_year, weekno).with(nextorsame...

regex: Why this negative lookahead doesn't work? -

Image
i have text this real:: real :: b real c now want match real without :: followed, , in case, want match 3rd real. tried regex lookahead real\s*(?!::) but matches real :: b real c for \s* means 0 or more \s , why real :: b being matched? update thanks wiktor stribiżew. using regex101 debugging tool. can find backtrack makes thing complicated. i came task similar can't solve real (xx(yy)) :: real (zz(pp)):: b real (cc(rr)) c again, want match real (cc(rr)) without :: following. real\s*\(.*?\)+(?!\s*::) this tried, failed. regex debug, due backtrack. how correctly? you need put \s* lookahead: real(?!\s*::) see regex demo the real\s*(?!::) matches real because real matches real , \s* matches 0 or more whitespaces, lookahead fails match @ :: and engine backtracks , is, frees space matched \s* , tries re-match string. since \s* can match empty string, real before :: b gets matched. see regex debugger scheme @ regex101 showi...

DataStax OpsCenter 6.0 won't start if HTTPS is enabled -

i upgraded dse 5.x , opscenter 6.0. works great except opscenter fails start if enable https using our own wildcard certificates. have .pem file cert chain , .key file password removed. same setup works opscenter 5.2.4 6.0 error below: [opscenterd] error: traceback (most recent call last): file "/usr/share/opscenter/jython/lib/site-packages/opscenterd/opscenterdservice.py", line 111, in setupwebserver file "/usr/share/opscenter/jython/lib/site-packages/opscenterd/webserver.py", line 108, in makewebserver file "/usr/share/opscenter/jython/lib/site-packages/opscenterd/sslutils.py", line 24, in make_ssl_context_factory file "/usr/share/opscenter/lib/py/twisted/internet/legacy_ssl.py", line 1133, in __init__ self.cachecontext() file "/usr/share/opscenter/lib/py/twisted/internet/legacy_ssl.py", line 1142, in cachecontext ctx.load_cert_chain(self.certificatefilename, keyfile=self.privatekeyfilename) # automatically checks aga...

laravel - 404 Error in larvel 5.1 Wamp -

Image
i beginner in laravel. used laravel 5.1 in wamp server (apache/2.4.9 (win64) php/5.5.12) i received 404 not found error, when called page http://localhost/laravel/public/login route::get('login', function() { //return view::make('login'); return 'hello world'; }); vhost.conf code serveradmin local@gmail.com documentroot "c:\wamp\www\laravel\public" servername localhost errorlog "logs/authoritycontroller.www-error.log" customlog "logs/authoritycontroller.www-access.log" common <directory "c:\wamp\www\laravel\public"> options indexes followsymlinks multiviews allowoverride order allow,deny allow </directory> try this: http://localhost/login may helps you, hope :). , check vhost in appache set .../your_laravel_project/public folder update go c:\windows\system32\drivers\etc\hosts , add line @ bottom: 127.0.0.1 myproject.dev then, in appache httpd.conf fi...

javascript - angular array loop and sort function -

i have array of objects, each object contains following properties: comments:"" id:1 inprogress:false jobdescription:null lastupdatedate:"07/08/2016" lastupdatedbyuser:"xxx@abc.com" product:"chicken" status:object templatename:"standard template" uploaddate:"07/08/2016 10:36:01" i need function in angular can loop through entire list , sort through uploaddate , have recent first, etc. i tried using did not work: vm.uploads = $filter('orderby')(vm.uploads, vm.uploads[0].uploaddate, reverse); array.prototype.sort enough : vm.uploads.sort(function(a,b){ return new date(a.uploaddate).gettime()- new date(b.uploaddate).gettime(); }) if want desc order , switch a & b

Python Email attachment loses end-of-newline "\n" -

my python script (as following) can send ".txt" attachment, unfortunately received attachment lost "\n", lines ruined column format. can please give me help? lot! msg['from'] = send_from msg['to'] = commaspace.join(send_to) msg['date'] = formatdate(localtime=true) msg['subject'] = 'subject of email4' mailbody = "this content of email4" msg.attach(mimetext(mailbody)) open("regresult.txt", "r") fil: part = mimeapplication( fil.read(), name=basename("regresult.txt") ) part['content-disposition'] = 'attachment; filename="%s"' % basename('regresult.txt') msg.attach(part) update: original file (opened in remote unix server vim) this: original file format the received file format this: received import smtplib import io sender = 'from@fromdomain.com' receivers = ['to@todomain.com'] file = io.o...

python - Django logout makes trouble with the error : Reverse for 'logout' with arguments '()' and keyword arguments '{}' not found -

my error below : reverse 'logout' arguments '()' , keyword arguments '{}' not found my 'urls.py' below : urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$',homeview.as_view(), name='home'), url(r'^about/$',aboutview.as_view(), name='about'), url(r'^login/$', views.loginview, name='login'), url(r'^inquiry/$',inquiryview.as_view(), name='inquiry'), url(r'^service_terms/$',servicetermsview.as_view(), name='service_terms'), url(r'^privacy_terms/$',privacytermsview.as_view(), name='privacy_terms'), url(r'^logout/$,', views.logoutview, name='logout'), ] my 'views.py' below: @login_required def logoutview(request): if request.method == 'post': logout(request) print('logout done') return render(request, 'about.html') my code logging out in 'navbar.html' below: <li...

Alphabetize using I/O in C# -

i'm trying use i/o , sort input file alphabetically using method called alphabetize, has compile error (35,42): error cs1061: 'string' not contain definition 'toarray' , no extension method 'toarray' accepting first argument of type 'string' found (are missing using directive or assembly reference?) what can resolve that? using system; using system.io; namespace examplefile { class examplefile { static void main(string[] args) { streamwriter writer = null; writer = new streamwriter(@"c:\c#files\outputwrite2.txt"); console.setout(writer); console.setin(new streamreader(@"c:\c#files\inputread2.txt")); string letters; while ((letters = console.readline()) != null) writer.close(); streamwriter standardoutput = new streamwriter(console.openstandardoutput()); standardoutput.autoflush =...

angularjs - Correct Paths for Java Spring with Angular UI-router -

Image
i've been trying implement ui-router spring getting bunch of 404s in browser. cannot seem path names correctly ui-router cannot switch view. i've looked @ similar problems on so, cannot working. is there specific way need structure project path names work? thought ui-router's templateurl worked root of project, tried putting path name started @ project root no success. building project using maven in intellij well, unsure if affecting problem @ all. i have controller ui-router structured this: var mymod = angular.module("mymod", ['ui.router']) .config(['$stateprovider', '$urlrouterprovider', '$locationprovider', function ($stateprovider, $urlrouterprovider, $locationprovider) { $urlrouterprovider.otherwise('/first'); $stateprovider .state('first', { url: '/first', templateurl: '/uiproject/src/main/resources/static/templates/database.html',...

Android app development like facebook -

guyz i'm new android development guide me me how make app user can click photos , upload description , others can or comment on smthng similar facebook thnks i'm not going able walk through step step can started places look. first of store pictures , information use firebase ( https://firebase.google.com/ ). far layout goes you're going want use either cardview or listview custom views. cardview explained here https://www.binpress.com/tutorial/android-l-recyclerview-and-cardview-tutorial/156 . there several ways listviews, either or custom libraries, don't want point towards 1 in particular recommend research yourself.

android - Game layout generator (no dead ends) -

Image
i'm trying make first game using stencyl. game based on simple concept finding difficult generate levels. this how game works, player stationary , able change lanes left , right, actual 'obstacles' (horizontal , vertical lines) moves down. need somehow generate these horizontal , vertical lines in way player never 'trapped' (i.e. 4 lanes never blocked off @ 1 time). my initial idea create few different layouts (10-30) , spawn random layout off screen (top) moves down. problem is not efficient memory wise. i thinking of creating sort of layout generator create , spawn possible layouts. open using different software/tools if need be. guidance appreciated. example of trying avoid

asp.net - Range validation error is always showing -

this razor: <div class="row form-group"> <label class="control-label col-md-2">number answer</label> <div class="col-md-6"> @html.textboxfor(t => t.selectedquestions, new { style = "width: 10%", @class = "form-control" }) @html.validationmessagefor(t => t.selectedquestions) </div> </div> this html generated: <div class="row form-group"> <label class="control-label col-md-2">number answer</label> <div class="col-md-6"> <input class="input-validation-error form-control" data-val="true" data-val-number="the field selectedquestions must number." data-val-range="the value entered must bigger zero." data-val-range-max="6" data-val-range-min="1" data-val-required="th...

python - Create child of str (or int or float or tuple) that accepts kwargs -

i need class behaves string takes additional kwargs . therefor subclass str : class child(str): def __init__(self, x, **kwargs): # code ... pass inst = child('a', y=2) print(inst) this raises: traceback (most recent call last): file "/home/user1/project/exp1.py", line 8, in <module> inst = child('a', y=2) typeerror: 'y' invalid keyword argument function which rather strange, since code below works without error: class child(object): def __init__(self, x, **kwargs): # code ... pass inst = child('a', y=2) questions: why different behavior when trying subclass str , int , float , tuple etc compared other classes object , list , dict etc? how can create class behaves string has additional kwargs? you need override __new__ in case, not __init__ : >>> class child(str): ... def __new__(cls, s, **kwargs): ... inst = str.__new__(cls, s) ... ...

c# - LINQ to group a list and return a list of a custom objects which has an embedded Dictionary -

i have large dataset , trying group dataset set of fields. in dataset have rows(of balances) 5 consecutive dates. goal return list of custom object has idictionary field key date , balance value. tried like: int[] dt = new int[] {20160725,20160726,20160727,20160728,20160729}; var tranformeddata = posdata .groupby(p => new {p.symbol, p.account}) .select(gp => new tposmodel { symbol = gp.key.symbol, account = gp.key.account, balances = new dictionary<int, decimal>{ { gp.where(gpi => gpi.busdate == dt[0]).select(gpi => gpi.busdate), gp.where(gpi => gpi.busdate == dt[0]).select(gpi => gpi.balance) }, { gp.where(gpi => gpi.busdate == dt[1]).select(gpi => gpi.busdate), gp.where(gpi => gpi.busdate == dt[1]).select(gpi => gpi.balance) }, . . . } this code causing duplicate key error. got work converting dictionary list of tuple not desired final outcome. have suggestion on h...

javascript - How to add three instances of Google Maps on same page -

i have had great result using javascript miguel marnoto's codepen 2 instances of google maps, i'm trying expand 3 or 4 instances, attempted initialize naming 2 other instaces, mapright , mapthree below. i'm not having luck, can advise on how extend miguel wrote here in original javascript codepen. https://codepen.io/marnoto/pen/vljvzz my new version below. // * // * 2 maps on same page, expanded 3 // * 2015 - en.marnoto.com // * // necessary variables var mapleft, mapright, mapthree; var infowindowleft, infowindowright, infowindowthree; // markersdata variable stores information necessary each marker var markersdataleft = [ { lat: 40.6486333, lng: -8.745, name: "camping praia farol", address1:"rua diogo cão, 125", address2: "praia da barra", postalcode: "3830-772 gafanha da nazaré" // don't insert comma in last item of each marker }, { lat: 40.54955, lng: -8....