Posts

Showing posts from February, 2010

android - Notification not showing up at specific time using AlarmManager and BroadCast receiver -

this call broad cast receiver class private void createalarmnotification() { // todo auto-generated method stub intent myintent = new intent(getapplication() , alarmset.class); alarmmanager alarmmanager = (alarmmanager)getsystemservice(alarm_service); pendingintent pendingintent = pendingintent.getbroadcast(getapplication(), 0, myintent, 0); calendar calendar1 = calendar.getinstance(); calendar calendar = calendar.getinstance(); calendar.set(2015, 3, 20, 23, 55, 00); alarm a= new alarm(); a.setalarm(mainactivity.this, calendar.gettimeinmillis(), 60*1000); } this broadcast receviver class public class alarm extends broadcastreceiver { private final long gmt6 = alarmmanager.interval_hour * 6; private final long day = alarmmanager.interval_day; private activitymanager activitymanager; private context context; @override public void onreceive(context context, intent intent) { this.context = context; ...

java - How to select a treeview node from code in eclipse-plugin -

i have custom outline in eclipse plug-in, implemented using class treeviewer , created outline using code: public class myoutlinepage extends contentoutlinepage (...) object[] data = (...) treeviewer treeviewer = gettreeviewer(); treeviewer.setinput(data); and after set input need select 1 specific element in outline. example, need select element data[2] in outline. must same click in element using mouse. the tree viewer has setselection method programmatically change selection. if wrap domain object structuredseletion corresponding treeitem selected. treeviewer.setselection( new structuredselection( data[2] ) );

css - Get button element and Style button using JavaScript -

<input type="submit" name="$submit$0" value="log in"> how element id/tag/class above type of button? want style too. is correct? if (document.getelementsbyclassname("submit") !== undefined || document.getelementsbyclassname("submit") !== null) { var ele = document.getelementsbyclassname("submit"); (i = 0; < ele.length; i++) { ele[i].style.color = "#6699ff"; ele[i].style.padding = "0px"; ele[i].style.height = "10px"; ele[i].style.width = "30px"; } } or? if (document.getelementsbytagname("submit") !== undefined || document.getelementsbytagname("submit") !== null) { var ele = document.getelementsbytagname("submit")[0]; ele.style.color = "#6699ff"; ele.style.padding = "0px"; ele.style.height = "10px"; ele.style.width = "30px"; } getele...

sql server - Allocation of space for nvarchar and varchar -

i remember time ago being told in academia oracle when given varchar of (9) allocate space store 16 bytes worth of characters though needed 9. (pre-wide characters) is still thing(was ever thing)? if allocate nvarchar(63) maximize storage space(assuming null character)? still take same space nvarchar(50)? there benefits indexing? i concerned mssql, interested know of databases. sql server allocates 2 bytes actual character in nvarchar string. nvarchar string declared nvarchar(10) ='ben' sql server allow names of 10 characters , use 6 bytes save string 'ben.' use space save actual length of string (i believe 2 bytes).

javascript - updating text on view from ng-repeat -

i have problem updating view using ng-repeat. when click on text, doesnt update overwrites below. (i want have panel names(links) , show description on view) have searched , couldnt find answer or useful me. html: <body> <div ng-app="myapp"> <div ng-controller="myctrl"> <ul> <li><a ng-repeat="item in items" ng-click="getinfo(item)" > {{item.name}} <br> </a></li> </ul> </div> <hr> <div ng-controller="myinfo"> <div ng-repeat="info in item" > <h3>name: {{info.name}}</h3> <p> id: {{info._id}}</p> <p> temp: {{info.temp}} </p> </div> </div> </div> </...

powershell - get-adprincipalgroupmembership not showing all groups -

viewing 'member of' tab in ad gui specific user shows multiple groups. running get-adprincipalgroupmembership "username" returns 1 group "domain users". affected user new user experiencing same issue new user able "discover" same groups user through powershell security identical on users , groups any appreciated!

php - Bigquery query failure handling -

i trying make sure streaming queries inserted successfully, , seems though of these queries not being inserted correctly. there no errors being thrown not using data returned insert request not know how errors structured. here insertion code: $rows = array(); $row = new google_service_bigquery_tabledatainsertallrequestrows; $row->setjson($data); $rows[0] = $row; $request = new google_service_bigquery_tabledatainsertallrequest; $request->setkind('bigquery#tabledatainsertallrequest'); $request->setrows($rows); return $this->service->tabledata->insertall($project, $dataset, $tableid, $request); the above code excludes authentication/setting client & service you can use method /** * * @param google_client $client * @param type $project_id * @param type $dataset_id * @param type $rows * @return mixed * @throws google_service_exception */ public function bq_tabledata_insertall($client, $project_id,...

cron - Laravel scheduler says "No scheduled commands are ready to run." -

i've setup command this: protected function schedule(schedule $schedule) { $schedule->command('feeds:fetch')->everyfiveminutes(); } i've setup cron job run php artisan schedule:run when run line on dev's terminal runs task ok. on prod returns "no scheduled commands ready run." any way troubleshoot this? the fine folks @ larachat ( https://larachat.slack.com/ ) helped me out debug issue. the problem crontab. setting crontab execute artisan scheduler follows: */1 * * * * php /path/to/artisan schedule:run (meaning execute every 1st minute of every hour every day.) when should be: * * * * * php /path/to/artisan schedule:run (meaning execute every minute of every hour every day.) so, when manually ran cron on non-1st minute of every hour, didn't run @ all.

html - "dancing divs" using jquery .innerhtml, .appendto and setInterval -

i'm working on html/javascript game has spell bar (div) spells show count down (also divs). when more 1 of spell divs added positioned below container div. i've attached jsfiddle link code. searched everywhere on google, didn't found answers. http://jsfiddle.net/l9dgu7so/ i tried using function instead of setinterval , no results. function interval(func, wait, times){ var interv = function(w, t){ return function(){ if(typeof t === "undefined" || t-- > 0){ settimeout(interv, w); try{ func.call(null); } catch(e){ t = 0; throw e.tostring(); } } }; }(wait, times); settimeout(interv, wait); }; replacing old 1 with interval(function(){ hbspelldown(champname, slot, cd); }, 1000, cd); i tried commenting out of danger_spell , danger_spell_inner , didn't eith...

ios - How to paste image from pasteboard on UITextView? -

i have following code on keyboard extensión let pasteboard = uipasteboard.generalpasteboard() var image = uiimage(named: "myimage"); pasteboard.image = image; this doesn't work on uitextview have on container application, paste context menu never shows up. works on other applications "messages" not on mine. my code works if try paste text instead of image using string property i'm quite near. i need set text view different don't know how. i've changed "text" "plain" "attributed" still not working. uitextview supports pasting text out of box. can subclass , add support pasting images, can implemented using attributed string text attachments . nshipster's writeup on uimenucontroller , this stack overflow question explain paste logic.

c++ - Undefined symbol when loading a shared library -

in program need load shared library dynamically dlopen() . both program , shared library cross-compiled arm architecture cross-compiler installed on x86 . however, whenever program tries load library @ run time on arm , fails giving error: undefined symbol: _dl_hwcap i cannot find culprit of error. let me give details on how shared library ( libmyplugin.so ) built on x86 first. use g++ cross-compiler below: /home/me/arm/gcc-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -march=armv7-a -mfloat-abi=hard -c -s -fpic -o build/module1.o module1.cpp /home/me/arm/gcc-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -march=armv7-a -mfloat-abi=hard -c -s -fpic -o build/module2.o module2.cpp /home/me/arm/gcc-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -o dist/libmyplugin.so build/module1.o build/module2.o --sysroot /home/me/arm/sysroot/ -wl,--no-as-needed -ldl -lx11 -lxext /home/me/arm/libstatic.a -shared -s -fpic please pay attention following notes: module1.cpp , m...

ember.js - Replace string in HTMLbars/Handlebars expression with component -

i've got blog. each blog-posts can have multiple downloads. downloads created component downloads render them @ end of each post this: {{#each download in sorteddownloads }} <p> <a class="dl-button" {{ action "incdownload" download }}> {{ download.name }} ({{ download.size}}mb) </a> - {{ download.downloadcount }} hits </p> {{/each}} i'd able write [downloads] in post content (which rendered via {{{post.parsedbody}}} and replace partial above one. is possible or have better way achieve this? this not achievable using either outlet or yield , since post content not interpreted render engine. what should working though have placeholder in content mentioned it, , replace identifiable html placeholder in post.parsedbody . create view on didinsertelement , , call view's appendto() method render downloads inside placeholder. one writing jquery-ish elements works, think inserting arbitrary el...

obiee - Repository variable usage - How to track? -

i have older repository variables i'm looking turn off. there way see these variables being used in reports? unfortunately, think best bet might search catalog using file system. catalog objects stored xml can search them repository variables have.

shell - How do I escape characters in a chain of aliases in tcsh? -

i want command cds greps string within output of dirs -v , uses pd + change me directory contains string without removing ring of directories stored within dirs . instance, if output of "dirs -v" 0 foo 1 bar then want command cds bar execute equivalent of pd +1 . i've defined these: alias dv dirs -v alias pd pushd alias pds "dv | grep \!:1 | awk '{ print "\$1"}'" but getting final alias executes pd +n , n current entry in output dirs -v , hard part. here 1 attempt, output: % alias nds "\\\`pds \\!:1\\\`" grep: trailing backslash as can see, i'm trying escape backticks backslash, escape backslash (escaped) backslash. apparently doesn't job. need instead? xargs useful "flatenning" commands containing backtick-nesting. in case, can used like: alias nds 'pds \\!:1 | xargs pd'

graphics - Combining a raytraced scene with a rasterized scene in DirectX11 -

i have 2 scenes in directx11, 1 using rasterization , other uses raytracing via full screen quad in pixel shader. i'm trying combine 2 while preserving correct depth information i'm not sure how go it. i suspect process like render raytraced scene , output 2 textures in pixel shader, 1 depth (using sv_depth) , 1 colour. apply both of outputs step 1 active colour , depth targets , render rasterized scene. does know how or have links regarding subject.

jquery - How can I keep the image highlighted upon click, even after browser refresh? -

basically, have 3 images: tried assign 'focus' them create border around image upon click. however, want following - if possible - happen: every image click stays highlighted, , when refresh browser clicked ones stay highlighted. or clicked image stay highlighed after browser has refreshed. a:focus img { border:1px solid #f00; } <a href="#"><img src="http://cdn.s7.disneystore.com/is/image/disneyshopping/1344039601602?$yetidetail$" alt="" /></a> <a href="#"><img src="http://cdn.s7.disneystore.com/is/image/disneyshopping/1344039601602?$yetidetail$" alt="" /></a> <a href="#"><img src="http://cdn.s7.disneystore.com/is/image/disneyshopping/1344039601602?$yetidetail$" alt="" /></a> any appreciated. have tried "visited" selector? a:visited img, image:visited { # awesome styling rig...

ruby on rails - rake db:migrate:reset to dump schema -

hell, i'm following in hartl's ruby on rails tutorial , i'm on chapter 9 adding administrative control users. i'm @ part says reset database: $ bundle exec rake db:migrate:reset $ bundle exec rake db:seed last time followed (much earlier in tutorial), reset database instructed deleted me schema.rb. annoying. attempted again, , yet again deleted database , erased schema.rb. surely not intended. i'm having trouble figuring out should doing anymore. i'm getting kinds of errors database. errors pending migrations, no db:xxx command works, every command spits out long list of errors such as /users/ke0/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:994:in `execute_migration_in_transaction' /users/ke0/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:956:in `block in migrate' /users/ke0/.rvm/gems/ruby-2.2.0/gems/activerecord-4.2.0/lib/active_record/migration.rb:952:in `each' /use...

c# - Can entity framework 6.1 work with object type -

i find out how can work object type entity framework 6.1 (code first, migration). lets have 3 objects: page, article , blog. i have in database 1 main table: page. article , blog tables contain id page table. when have list of pages should able check type of each object - article , blogs. when save article object database, should saved on page table article type in database (page record article record , ids between them). any advice propitiated thank you ori

javascript - Show hidden div on change of a select field -

i have select field id #dailywardentry-ipd_patient_id , div id , class <div id ="div2" class="hidden"> i using css keep div hidden on load .hidden { display: none; } using function show div on change of select field above. div hidden on load, should show on change. <script type="text/javascript"> $(function(){ $("#dailywardentry-ipd_patient_id").on("change", function(){ $("#div2").removeclass('hidden');; }); }); </script> what doing wrong here? thanks ok think there conflict in jquery library working in yii2 framework, loads own jquery. i done using code: <?php $this->registerjs("$('#dailywardentry-ipd_patient_id').on('change', function(){ $('#div2').removeclass('hidden'); });"); ?>

C++ Error: no match for call to '(Vector3 (double, double, double)' -

so i'm having error prevents me continuing assignment. here code: #include "std_lib_facilities.h" class vector3 { public: vector3(); vector3(double x1); vector3(double x1, double y1); vector3(double x1, double y1, double z1); //helper functions double x() {return x1;} double y() {return y1;} double z() {return z1;} private: double x1,y1,z1; }; /** constructor definitions **/ vector3::vector3(double x, double y, double z){ x1=x; y1=y; z1=z; } vector3::vector3(double x, double y){ x1=x; y1=y; } vector3::vector3(double x){ x1=x; } vector3::vector3() { x1=0; y1=0; z1=0; } /** operator overloading **/ ostream& operator<<(ostream&os, vector3& v) //<< overloading { return os <<"["<<v.x() <<", "<<v.y() <<", "<<v.z() <<"]"<<endl; } vector3 op...

c# - Hide task bar in maximized state when WindowStyle is SingleBorderWindow -

i'm putting option in settings window user choose whether show windows task bar or go fullscreen when maximize window. i tried this static readonly intptr hwnd_topmost = new intptr(-1); const uint swp_nosize = 0x0001; const uint swp_nomove = 0x0002; const uint swp_showwindow = 0x0040; public static void setformtopmost() { intptr windowhandle = new windowinterophelper(application.current.mainwindow).handle; setwindowpos(windowhandle, hwnd_topmost, 0, 0, 0, 0, swp_nomove | swp_nosize | swp_showwindow); } but not working. not making topmost.. you can try method: public void maximizewindow(bool isfullscreenwithtaskbar) { if (isfullscreenwithtaskbar) { this.maxheight = systemparameters.maximizedprimaryscreenheight; } this.windowstyle = windowstyle.singleborderwindow; this.resizemode = resizemode.noresize; this.windowstate = w...

css - navigation bar links move when hover -

in html page have following hover action on navigation links. <td class="menunormal" onmouseover="expand(this);" onmouseout="collapse(this);" width="130" align="left"> <p><b>vida de mulher</b></p> <div class="menunormal"> <table class="menu" width="130"> <tr> <!-- ... --> and css style sheet used hover action: table.navbar { font-size: 12pt; margin: 0px; padding: 0px; border: 0px; } table.menu { font-size: 11pt; margin: 5px; padding: 0px; } td.menunormal { padding: 0px; color: #003399; vertical-align: top; background-color: #f6f6f6; } td.menuhover { padding: 0px; color: #003399; width: 112px; vertical-align: top; background-color: lightblue; } this may caused :hover effect in css, or maybe removing width of td class .menunormal ...

typescript - Sailsjs model static method -

i'm trying create type definition sails.js's model interface. sails.js allows define simple file exports object nested "attributes" object. each attribute corresponds column name in database, , column type. //mymodel.js module.exports = { attributes:{ name:"string" } }; to use model in code, write code so: mymodel.create({name:"alex"}).then(function(result){ //the model inserted db, result created record. }); the code wrote looks so: declare module sails{ export interface model{ create(params:object):promise<sails.model>; } } class model implements sails.model{ create(params:object):promise<sails.model> { return undefined; } attributes:object; constructor(attributes:object){ this.attributes = attributes; } } class mymodel extends model{ constructor(attributes:object){ super(attributes); } } var _export = new mymodel({name:string}); export = _export; here...

vim - Change recognized filetype of a plugin -

i want use 'plasticboy/vim-markdown' , 'nelstrom/vim-markdown-folding.' require filetype=mkd , filetype-markdown , respectively. there typical way tell plugin recognize filetype? i've tried changing references of mkd markdown in former , markdown mkd in latter hasn't had effect. of now, can use 1 of plugins because require different filetypes. the generic names filetype plugins ( :help ftplugin-name ): ftplugin/<filetype>.vim ftplugin/<filetype>_<name>.vim ftplugin/<filetype>/<name>.vim therefore, need rename file names (possibly in addition contents in file, though there shouldn't many). since makes upgrading more difficult, can write linker scripts, e.g. ~/.vim/ftplugin/mkd_fold.vim contains following command: :runtime! ftplugin/markdown_fold.vim

jquery - Fade in background/div with title/div always visible on top -

i have jquery fades in .gridhover . covers .title . i tried changing z-index, hover effect stops when hovering title. tried duplicating title , fading in well, doesn't work , looks sloppy. i keep .title visible @ times (maybe change color on hover of .gridhover ) , hover effect hover-able on whole area of .gridhover . firstly, possible? secondly, how? :) html <div class="gridcontainer" style="background-image: url('image.jpg'); background-repeat: no-repeat; background-size: cover; background-position: 50% 50%;"> <div class="title">title</div> <a href="#"> <span class="gridhover"></span> </a> </div> jquery // grid hover - overlay ----------------// $('.gridhover').each(function(index) { $(this).hover( function () { $(this).fadeto(100, .85); }, function () { $(this).fadeto(400, 0); ...

ios - app does not function properly in iphone 5 and 4s simulator -

this weirdest thing, when run app in simulator on xcode functions except when try run in iphone 4s simulator , iphone 5 simulator acts funny. in function below have animations taking place. , mean acting funny these animations run smoothly , can see dots created move across screen gradually in iphone 4s , 5 simulators dont see animations @ or see brief flashes of them have no idea why. please help!! func go () { // remove add banner view self.gameadbanner?.hidden = true // enable user interaction of content view self.contentview.userinteractionenabled = true // make level label appear uiview.animatewithduration(0, delay: 1, options: nil, animations: { self.levellabel.alpha = 1 self.levelnumber.alpha = 1 }, completion: {finished in self.displayad()}) // declare delay counter varriables var delaycounter:int = 100000 var durationcounter:double = 0 // initiate starting level levelnumber.text = string(level...

c++ - Parsing integer from comma delimited string -

i'm new c++ , trying find example code extract integers comma delimited strings. come across code: std::string str = "1,2,3,4,5,6"; std::vector<int> vect; std::stringstream ss(str); int i; while (ss >> i) { vect.push_back(i); if (ss.peek() == ',') ss.ignore(); } i have trouble understanding while loop conditional statement: ss >> i . understanding, istream::>> returns istream operated on. error bits may set operation. there doesn't seem boolean variable involved. how can ss >> i serve conditional statement? additionally, >> extract 1 or multiple characters? example, if have string "13, 14". operation return integers 1, 3, 1, 4 or integers 13, 14? thanks lot, m 1) conditional statement. std::stringstream derives std::ios, defines: in c++ 98 / c++ 03: operator void*() const description: null pointer if @ least 1 of failbit or badbit set. other value otherwise. ...

sql server - Create string with embedded quotes in SQL -

i run several queries use list of character values in clause, e.g., select * table1 col1 in ('a','b','c') the character list changes frequently, want store string in variable , reference variable in of queries instead of maintaining several copies of string. i've tried following query returns 0 rows. declare @str varchar(50) select @str = '''a''' + ',' + '''b'''+ ',' + '''c''' select * table1 col1 in (@str) @str has value 'a','b','c' reason, sql server doesn't recognize it. how build string , store in variable works in keyword? the in construct in sql set lookup, not string lookup. single string value of "'a','b','c'" it's looking when col1 in (@str)... fredou mentioned in comments. instead want pass in set of values using table variable (or temp table): declare @tabi...

javascript - Should I worry about these JSLint warnings on HTML5Shiv.min.js version 3.7.2? -

i copied version of html5shiv.min.js cloudflare link, , when import file adobe brackets, jslint compiler tells me script contains following errors: 4 missing 'use strict' statement. !function (a, b) {function c(a, b) {var c = a.createelement("p"), d = a.getelementsbytagname("head")[0] || a.documentelement; return c.innerhtml="x<style>"+b+"</style>",d.ins 4 'c' defined. !function (a, b) {function c(a, b) {var c = a.createelement("p"), d = a.getelementsbytagname("head")[0] || a.documentelement; return c.innerhtml="x<style>"+b+"</style>",d.ins 4 expected ';' , instead saw '='. !function (a, b) {function c(a, b) {var c = a.createelement("p"), d = a.getelementsbytagname("head")[0] || a.documentelement; return c.innerhtml="x<style>"+b+"</style>",d.ins 4 unreachable '=' ...

java - Using HashSet to store a text file and read from it -

i've seen lot of great resources regarding hassets, nothing helps me particular problem. i'm taking algorithms class on generics , assignment requires txt file read system using scanner (which done) , using hashset, load txt file can read user input , find number of occurrences of word. have method returning words , have of hashset , file reader code done. i'm stuck on how store whole txt file 1 hashset. couldn't work doing crime.add , tried several other things. missing easier way implement method? thanks edit: assignment instructions - program 1 (70 points) load java.util.hashset the words novel “crime , punishment”, theodore dostoevsky (text file available on blackboard assignment). prompt user enter word , report whether or not word appears in novel. edit: ok, have of written , runs not finding words in txt file, somewhere went wrong adding file hashset. ideas? i've tried array list, different string implementations , don't know turn. helpful info....

jQuery - How can I toggle a custom checkbox with only one checkbox active at a time? -

i have created list of custom checkboxes. @ moment can select 1 checkbox @ time great; want toggle 'active' checkbox. any appreciated, i've been trying fix on hour :) here's code: html: <ul> <li> <a><i class="fa fa-square-o"></i> option 1</a> </li> <li> <a><i class="fa fa-square-o"></i> option 2</a> </li> <li> <a><i class="fa fa-square-o"></i> option 3</a> </li> </ul> css: // using borders represent checked/unchecked box demonstration .active { color: red; } // non-checked box .fa-square-o { border-style: solid; border-width: 0px; } // checked-box .fa-check-square-o { border-style: solid; border-width: 1px; } jquery: $('li a').bind('click', function() { $('li a').not(this).removeclass("active"); ...

Android Studio count how many days since application was last opened -

this personal project, i'm creating little basic journal other things. have no idea begin honest, when application launches want display in textview how many days has been since application last launched. please can help, basic working example best take can :) thanks in main activity oncreate , check sharedpreferences last used date, , display if present. save today's date.

html - Aqua button in CSS multiple browsers -

Image
i trying create aqua themed button looks great across multiple browsers. new css, please kind. i have found example on-line looks great in chrome... not show in ie... below button in chrome... html: <div class="button aqua"> <div class="glare"></div> button label </div> css: .button{ width: 120px; height: 24px; padding: 5px 16px 3px; -webkit-border-radius: 16px; -moz-border-radius: 16px; border: 2px solid #ccc; position: relative; /* label */ font-family: lucida sans, helvetica, sans-serif; font-weight: 800; color: #fff; text-shadow: rgba(10, 10, 10, 0.5) 1px 2px 2px; text-align: center; vertical-align: middle; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; } .aqua{ background-color: rgba(60, 132, 198, 0.8); background-image: -webkit-gradient(linear, 0% 0%, 0% 90%, from(rgba(28, 91, 155, 0.8)), to(rgba(108, 191, 255, .9)))...

Relative Frequency in Python -

is possible calculate relative frequency of elements occurring in list in python? for example: ['apple', 'banana', 'apple', 'orange'] # apple example 0.5 you can use nltk this: import ntlk text = ['apple', 'banana', 'apple', 'orange'] fd = nltk.freqdist(text) check out tutorial in book how to , the source code alternately, use counter: from collections import counter text = ['apple', 'banana', 'apple', 'orange'] c = counter(text)

asp.net mvc - 'x' is a 'variable' but is used like a 'method' -

i'm struggling curious situation. have collection of pages mean iterate through in razor. need twice, once within script tag , once outside. now, understand razor meant generate html , not javascript working fine , it's breaking , can't figure out quite why. here's code breaks: <script type="text/javascript"> @foreach (string page in pages) { <text> function @page() { // here } </text> } </script> this works fine: <div class="intro"> @foreach (string page in pages) { <div id="@page"> <!-- whatever --> </div> } </div> compiler error message: cs0118: 'page' 'variable' used 'method' and points use of @page . in fact vs13 red-squiggles use of variable but in first case ! what's going on here? try <script type="text/javascrip...

asp.net - Could not load file or assembly kre-clr-win - How can I specify the KRE? -

i'm trying build first application asp.net 5 in visual studio 2015 ctp. published app file system , copied folder aws ec2 instance. setup application in iis points wwwroot directory published app. i keep getting yellow screen of death (ysod) when trying run app. looking @ event viewer, can see unhandled exception being thrown: exception message: not load file or assembly 'file:///c:\inetpub\wwwroot\appname\approot\packages\kre-clr-win-x64.1.0.0-beta3\bin\kre.clr.managed.dll' or 1 of dependencies sure enough, file doesn't exist on disk. never published application. do, however, have x86 version: kre-clr-win-x86.1.0.0-beta3. directory published app. so reason app being published kre-clr-win-x86, when try run published app it's looking kre-clr-win-x64. how fix issue? edit here generated web.config in published wwwroot folder: <configuration> <appsettings> <add key="kpm-package-path" value="..\approot\packag...

ruby on rails - ActiveRecord::Relation returning different class object -

i have rails 4.2 webapp. has typical user model based off devise people sign up, log in, , thing. at same time, have model called partner , connected remote database called partner_data containing table called ' user '. in rails console, getting object of user class when should partner. ideas on what's happening? > abc_partner = partner.where(id:200) => #<activerecord::relation [#<user id: 262, email: "abc@abc.xyz", created_at: ...>]> > abc_partner.class => partner::activerecord_relation > abc_partner.first.class => user(id: integer, email: string, encrypted_password: string ... ) a temporary fix i've done is abc_partner.becomes(partner) => #<partner id:262 name: 'john doe', partners_since:'2013-03-19', location:'new york, ny', company:'abcd corp.'> however: have asset model that's connected same remote database, using table of same name ' asset ' , works: ...

javascript - Getting Unexpected Token ILLEGAL JS Error -

i keep getting "unexpected token illegal" error when on script once registered on page. stringbuilder str = new stringbuilder(); str.append("<script type='text/javascript'> function anotherfunction(evt) { "); str.append("var xhr = new xmlhttprequest();"); str.append("var data = new formdata();"); str.append("var files = $('#fileupload1').get(0).files;"); str.append("for (var = 0; < files.length; i++){"); str.append("data.append(files[i].name, files[i]);}"); str.append("xhr.upload.addeventlistener('progress' , function (evt){"); str.append("if (evt.lengthcomputable) {"); str.append(" var progress = math.round(evt.loaded * 100 / evt.total);"); str.append("$('#progressbar').prog...

Get description of a Wikidata property? -

how can human readable property description of wikidata property (e.g.: p31 ) using pywikibot? you can use action=wbgetentities properties, normal item. to human readable descriptions p31 : https://www.wikidata.org/w/api.php?action=wbgetentities&ids=p31 and limit results 1 language (english): https://www.wikidata.org/w/api.php?action=wbgetentities&ids=p31&languages=en using pywikibot task seems bit of overkill (pywikibot framework building bots mass editing , like, on wikipedia). i'm not sure it's possible. there other, more lightweight frameworks, wikitools . wikitools, this: from wikitools import wiki, apirequest pid = "p31" endpoint = "http://commons.wikimedia.org/w/api.php" username = "xxx" password = "xxx" site = wiki(endpoint, username, password) params = {'action':'wbgetentities', 'ids': pid} request = apirequest(site, params) result = request.query() print result[...

Python Networking responding wtih 'b' -

i've started python networking, , after looking @ few internet tutorials, gave go... problem is, whenever response sever, prints in: recieved from: (host & port)b'hey' - haven't put b anywhere. here server code: import socket import tkinter import time import sys def main(): top = tkinter.tk() top.configure(background='black') host = '10.0.0.2' port = 5000 s = socket.socket() s.bind((host, port)) s.listen(1) c, addr = s.accept() while true: con = tkinter.label(top, text="connection from: " + str(addr), bg='red', fg='white').pack() data = c.recv(1024) if not data: break conn = tkinter.label(top, text="recieved from: " + str(addr) + str(data), bg='black', fg='white').pack() top.mainloop() c.close() main() and client: import socket def main(): host = '10.0.0.2' port = 5000 s = socket.socket() s.connect((host, port)) message = input("> ...

haskell - Get indices of Applicative Traversable without dummy -

let's have v , both applicative , traversable . how can v indices of v ? concrete example, consider v3 linear . want v3 0 1 2 . one way use mapaccuml dummy, example: snd $ t.mapaccuml (\idx _ -> (idx + 1, idx)) 0 (pure "") :: v3 int but (pure "") dummy feels inelegant. how can in more elegant way? you not going escape using pure if doing applicative , traversable . it's function in classes gives value of type without having one. also, dummy determines shape of value construct. consider type such lists, not values have same shape: how choose between constructing [0] , [0,1] or [0,1,2] ? (a pure -based dummy gives first one.)

one Azure mobile service NotificationHub to send Push Notifications to Two Different IOS Apps -

we using azure mobile service node end server. using notification hub push notify our ios , android clients. however, have 1 more requirement develop admin portal app in ios. so,we going develop 1 separate app admin portal.this app has requirement send push notification. means azure mobile service have send notifications existing ios , android app new ios admin app. my doubt is, can send push notification 2 different clients of ios single azure mobile services notification hub? because when checked push configuration on azure portal shows 1 .p12 file upload provision. in case 2 different .p12 files i.e. 1 uploaded existing ios client , 1 have upload ios admin app. can me or guide me right path? quite new azure mobile services. searched lot regarding topic did not related scenario. will possible send push 2 separate ios clients pointing same azure mobile service notification hub? or have create separate mobile service that? you need separate notification hub each...

Working in mysql with foreign keys -

i want create mysql database foreign keys. when insert test data notice when in tables tblcontact , tbladdress foreign key null. know basic question can give suggestions? create table tblcustomers ( customerid int not null auto_increment primary key, firstname varchar(30) not null, lastname varchar(30) not null, vat varchar(30) not null, customervisible varchar(1) not null default 't' ); create table tblcontact ( contactid int not null auto_increment primary key, email varchar(100), phone varchar(100), customerid int, constraint fk_customerid foreign key (customerid) references tblcustomers(customerid) ); create table tbladdress ( addressid int not null auto_increment primary key, street varchar(100), housenumber varchar(15), city varchar (100), country varchar (100), customerid int, constraint fk_customerida foreign key (customerid) references tblcustomers(customerid) ); insert tblcustomers (firstname, lastname,vat) values ("john","doe",...

How to get the rowcount from php file in android -

i'm comparing username , password user input database data, , used count check if equal 1 or 0. if it's equal 1, edittext should set 1, , if it's 0 should set 0. my problem is, it's set 0 if username , password correct. here name value pair , connection database: username = etlogusername.gettext().tostring(); password = etlogpassword.gettext().tostring(); string output = ""; //setting namevaluepair list<namevaluepair> namevaluepairs = new arraylist<namevaluepair>(1); //adding string variables inside namevaluepairs namevaluepairs.add(new basicnamevaluepair("user_username", username)); namevaluepairs.add(new basicnamevaluepair("user_password", password)); httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost("http://thesis-account.byethost7.com/workout_select_username.php"); httppost.s...

Sorting integers in a csv file - python -

i have csv file looks this: tom,10 jack,10 alice,10 ben,9 i need able sort second column highest lowest. have tried following code: import csv file = open("bestscores.csv","r") reader = csv.reader(file, delimiter = ' ') sort = sorted(reader,key=lambda x: int(x[1]), reverse=true) print(sort) this results in following error: valueerror: invalid literal int() base 10: 'tom,10' how can solve this? you using wrong delimiter , sorting wrong index. should work you: import csv open("bestscores.csv","r") fh reader = csv.reader(fh, delimiter = ',') sort = sorted(reader, key=lambda x: int(x[1]), reverse=true) print(sort)

Attempted to read or write protected memory : C++ Modified Value of Memory -

this question has answer here: why segmentation fault when writing string initialized “char *s” not “char s[]”? 16 answers i trim string "char array in c , c++ or char pointer" use function: inline char * trimright(char * str) { char * end = str + strlen(str); while(str != end) { end--; switch(*end) { case ' ': case '\t': case '\n': case '\v': case '\f': case '\r': break; default: *(end+1) = '\0'; return end+1; } } return str; } but return error (reason in code *(end+1) = '\0' ) : an unhandled exception of type 'system.accessviolationexception' occurred in x.exe additional information: attemp...

Missing or invalid url parameter while posting image with twitter API -

i trying post image on twitter. image in server. here code $tweet_img = '/home/voucherscode/public_html/editsocial/'.$tweet_img; $returnt = $connection->post('statuses/update_with_media', array( 'media[]' => file_get_contents($tweet_img), 'status' => "$tweet_msg" )); but response stdclass object( [errors] => array ( [0] => stdclass object ( [code] => 195 [message] => missing or invalid url parameter. ) )) please help. i got issue. using old twitteroauth , on post function has not multipart parameter. i replaced twitteroauth https://github.com/tomi-heiskanen/twitteroauth/blob/77795ff40e4ec914bab4604e7063fa70a27077d4/twitteroauth/twitteroauth.php , works below code. $tweet_img = '/home/voucherscode/public_html/editsocial/'.$tweet_img; $handle = fopen($tweet_img,'rb'); $image = fread($handle,filesize($...

twitter bootstrap - Share CSS styles across web components -

i using mozilla - x-tabs , web components in application tabbing it. now, need use bootstrap - glyphicons in app. since webcomponents use shadow-dom, bootstrap css styles not applied inside web components? is there way around it, share css file/style web components? you possibly want read css scoping model w3c. each polyfill library (i’m sure, e.g., mozilla’s does) provides handlers /deep/ , ::content etc selectors. hope helps.

c++ - Couln't someone explain the grammar of typedef once and for all? -

i know how declare aliases simple types, class types, primitive types and, say, pointers functions returning value of types. actually: typedef int t; //t := int typedef int* t; // t := int* typedef int (*t)() //t := int (*)(). ok, it's bit unclear me. //seems little bit confused typedef int (*t[])() // t := array of int(*)(). totally confused. hell going on? i can't understand how compiler should parse such typedef declarations. maybe can explain on simple example cited? know, c++ introduced alias decalrtion follows: using t = int*; it more readable, i'm interested in typedef decalration. the grammar of typedef same of variable declaration; difference name being declared becomes alias type, rather object, reference or function. note typedef part of decl-specifier-seq of declaration; full declaration consists of 3 parts: attribute-specifier-seq (new c++11), decl-specifier-seq , , init-declarator-list , in order. parts may in p...

C-programming loop wont stop with scanf!=0 -

what wrong ? also, have use scanf() . supposed read integers , sum them, loop stop when 0 entered.. main (void){ int a; int r=0; while(scanf(" %d",&a)){ r=r+a; } printf("the sum %d\n",r); return 0; } quoting man these functions return number of input items assigned. can fewer provided for, or zero, in event of matching fail- ure. 0 indicates that, although there input available, no conver- sions assigned; typically due invalid input character, such alphabetic character `%d' conversion. value eof returned if input failure occurs before conversion such end- of-file occurs. if error or end-of-file occurs after conversion has begun, number of conversions completed returned. so, pretty explains returned scanf() . you can solve problem adding ( 1 == scanf("%d", &a) && != 0 ) condition in while loop like int main (void) { int ...

java - Cannot resolve constructor when using ArrayAdapter -

i'm getting myself in muddle arrayadapter i'm trying put together. i've got constructor, person, used put people go in list. i'm putting arraylist of type person make readable list. i put arrayadapter list can seen in listview, i'm getting "cannot resolve constructor" code. i've tried countless possible solutions on site including trying use getactivity() or in place of peopleactivity.this, cannot code compile. i've tried referencing constructor class in arrayadapter, gives me error it's not enclosing class. person.class (constructor) import android.text.editable; public class person { public person person; private editable personname; public person(editable a) { personname = a; } public void setname(editable personname){ this.personname = personname; } public editable getname() { return personname; } } peopleactivity - populatelistview arraylist<person> peoplelistv = new arraylist<person>(); ... ...

Cordova Android app, file_not_found when trying to upload to remote server -

i trying upload file remote server using cordova android application, can resolve url of file path , can print path of file can find file , exist. whenever go upload file keeps failing error code of 1 means file not found. file located on sd card , create using app. here code uploading file. function upload() { window.resolvelocalfilesystemurl( "file:///storage/emulated/0/testfile5.txt", gotfileaddress, error); } function error() { alert("no file"); } function gotfileaddress(fileentry) { fileurl = fileentry.tourl(); server = encodeuri("http://test.server.com/upload"); alert(fileurl) var options = new fileuploadoptions(); options.filekey = "file"; options.filename = fileurl.substr(fileurl.lastindexof('/') + 1); options.mimetype = "text/plain"; alert("a"); var params = {}; params.value1 = "test"; ...