Posts

Showing posts from February, 2013

Facebook PHP SDK- Storing user data in MySql database not working -

i have been using fb sdk can user login fb account, during phase want user data stored on db , after following multiple solutions on doesn't seem work. data printing out variable proving there nothing wrong that, think there wrong sql insert statement cant seem see it. my code main page given below: <?php // path php-sdk include('config.php'); require '......./src/facebook.php '; $facebook = new facebook(array( 'appid' => '', 'secret' => '', )); /* $facebook = new facebook(array( 'appid' => appinfo::appid(), 'secret' => appinfo::appsecret(), 'sharedsession' => true, 'trustforwarded' => true, )); */ // see if there user cookie ## connect mysql server $mysqli = new mysqli(db_server, db_username, db_password, db_database); # check connection if ($mysqli->connect_errno) { echo "<p>mysql error no {$mysqli->connect_errno} : {$mysqli->connec

c# - ILNumerics: manually created ticks -

i created manual ticks shown on ilnumerics page: http://ilnumerics.net/axis-configuration.html . let take first example dates on x-axis. problem following: in program want use interactive mouse zoom , drag. if tick labels , gridlines drawn out of left , right borders of plotcube. (also in mentioned example.) i found out can fix gridline problem using clipping property of plotcube. panel size looks this: plotcub.clipping = new ilclipparams{ plane0 = new vector4(1, 0, 0, 0.63f), plane1 = new vector4(-1, 0, 0, 0.63f) }; but tick labels still drawn outside borders. workaround right place panels on left , right of plotcube. guess there better way deal that?!? and problem clipping fits current panel size. want change panel size @ runtime , clipping doesn't fit more. didn't find out how correct factors clipping. or there another/better solution? thanks in advance help! edit: sorry, seems blind!! used tickcreationfunc @ http://

javascript - filling ul li with images -

i have problem ul li fill <ul> <li></li> <li></li> <li></li> <li></li> </ul> i need put in li javascript but please without example : $("ul").html("<li><img src='something' /></li>"); because need ul li before javascript load. i want after javascript : <ul> <li><img src='something' /></li> <li><img src='something' /></li> <li><img src='something' /></li> <li><img src='something' /></li> </ul> my question : how fill ul li images. and javascript work loop. because maybe have variant : <ul> <li></li> <li></li> <li></li> <li></li> </ul> 4 li , 2 image, , : <ul> <li><img src='something' /></li>

How to start Logstash config-file -

i have problem logstash when want start config file command"bin/logstash -f logstash-rt.conf" return: error: no config files found: logstash-rt.conf can make sure path logstash config file? may interested in '--configtest' flag can use validate logstash's configuration before choose restart running system. can me ? thanks you need put config file in logstash folder , path should of logstash folder when execute command bin/logstash relative path when run conf file is.

android - how to detect and notify user of message from server? -

app sent transaction server, user closes app, message needs sent phone server 10+ minutes later. phone may asleep, or user might checking email. question have is: how can phone notified message has been received server ? how display message ? a possible solution google cloud messaging, still not able answer these 2 questions 1) have use service that. 2) , show message. do this. the variable , method members of service class: public final static string action = "com.apps.example.mainactivity"; private void messagefromserver()//this method sends broadcast messages { intent intent = new intent(movement_update); string messagefromserver=servermessage //here put server message intent.putextra("messagefromserver", messagefromserver); sendbroadcast(intent); } and methods main activity: you have register receiver in onresume method: @override public void onresume() { intentfilter intentfilter; intentfilter= ne

Android stack of fragments view -

Image
now i'm developing app in 1 of functions showing users profiles. profiles designed stack of fragment or views. each fragment or view under previous fragment or view , can swiped animation. can see on image: but don't know how this. maybe there libs me thing or ideas ? thx this great fragment transaction library https://github.com/desarrolloantonio/fragmenttransactionextended you can use fragmenttransactions replace, add, remove etc. http://developer.android.com/reference/android/app/fragmenttransaction.html

ios uitextfield to get text and manage label and image how to manage this -

Image
i want make speech bubble app , if have demo link please share me ,here share image please me have 1 text field , textfield text set in label dynamic height , image set dynamic height width here share image link please check link image screenshot have facing lost of problem here code here code -(void)textheight { nsstring *message = txtmain.text; cgsize size = [message sizewithfont:[uifont fontwithname:fontname size:fontsize] constrainedtosize:cgsizemake(lbltextinbubbles.frame.size.width, 9999.0f) linebreakmode:nslinebreakbycharwrapping]; cgfloat height = size.height+60; cgfloat width = size.width+50; // nslog(@"w== %f,, h==%f",width,height); if(lblpositionwidth < 210) { if(lblpositiondynamicchange > 33) { lblpositiondynamicchange=lblpositiondynamicchange-3; } lbltextinbubbles.frame=cgrectmake(lblpositiondynamicchange, lbltextinbubbles.frame.origin.y, width, height); lblp

Android.mk: Unsupported source file extensions for C files -

in android.mk file have this local_path:= $(call my-dir) include $(clear_vars) local_module := testmodule file_list := $(local_path)/include/md5/md5.с file_list += $(local_path)/include/md5/md5main.с file_list += $(wildcard $(local_path)/include/*.cpp) local_src_files := $(file_list:$(local_path)/%=%) include $(build_shared_library) but when run ndk-build - following error android ndk: warning: unsupported source file extensions in /users/some/path/jni/android.mk module testmodule android ndk: include/md5/md5.с include/md5/md5main.с (i use android-ndk-r8c on osx 10.9.2) how can add *.c file android.mk? doing wrong? (i can post more of android.mk , application.mk if needed) just move answer comments, @greenapps said works: you rename them .cpp , if not possible create .cpp file in include both .c files.

php - Constrain when create table mysql failure -

i new php mysql , restrict user input value. example type should m or c not others. therefore use code following create table1 under database hactl. /**********************************************************************/ /*create database , table*/ create database hactl; create table hactl.table1( type varchar(1) not null, region varchar(50) not null, country varchar(50) not null, city varchar(3) not null, imp decimal(10,2) not null, exp decimal(10,2) not null, ts decimal(10,2) not null, year int(4) not null, month varchar(3) not null, constraint chk_hactl check(type in ('m','c') , month in ('jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec') ) ); while when insert new row type = k,

how to build a trapezoid shape in android? -

Image
how can create trapezoid shape below image ? i don't want use image or 9.png . try this: <?xml version="1.0" encoding="utf-8"?> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="292dp" android:height="172dp" android:viewportwidth="292" android:viewportheight="172"> <path android:strokewidth="1.5" android:strokemiterlimit="10" android:pathdata="m 27.046 96.615 l 16.416 150.396 l 271.534 150.396 l 186.495 22.836 l 37.676 22.836 l 27.046 86.615 z" /> <path android:fillcolor="#00ff00" android:strokewidth="1.5" android:strokemiterlimit="10" android:pathdata="m 16.046 20.615 l 13.416 150.396 l 271.534 150.396 l 186.495 22.836 l 37.676 22.836 l 16.046 23.615 z " /> </vector>

visual c++ - C++ cin.clear() and cin.ignore(...) issue -

so, have several fields fill in numerals. , if try fill in input letters (ex. 'noway' or 'gg1337' - makes , error , asks valid number (without letters ex. '13' or '1500000'). but there 1 problem, if start fill input numbers , add letters (for ex. '12nowshithappens'), jumps next field of input, thinking valid number, showing error in next input field. here function code: int appled() { cin >> appleds; while(cin.fail()) { cin.clear(); cin.ignore(numeric_limits<streamsize>::max(),'\n'); cout << "an arror occured!\nplease, enter valid number: "; cin >> appleds; } return appleds; } if described wrong - here full code of test program :) // exzerry presents #include <iostream> #include <conio.h> int apples; int fruit; int oranges; int x; int appleds; int orangeds; using std::cout; using std::cin; using std::endl; using st

php - Woocommerce include element in products-only list page -

i need include sidebar in product list page. mean last child page there no categories or subcategories select, products. problem can't find can include code that. there content-product.php file generate list of products (without categories or subcategories), loop starts , ends in different files ( loop-start.php , loop-end.php ) , used both products-only loop ( content-product.php ) , categories/subcategories loop ( content-product-cat.php ). i found woocommerce conditional tags checking in page in, can understand, there no possibility seperate products-only list page categories/subcategories list page these functions. maybe had similar before , kind shere knowledge? woocommerce have way of telling if there products shown on page. check in archive-content.php ( https://github.com/woothemes/woocommerce/blob/master/templates/archive-product.php ). basically, when you're output sidebar, add check see if there are/were posts on page. woocommerce can use have_

asp.net - Passing C# object into vbscript -

is there way pass c# object( in case i'm using adodb.recordset) vbscript? or way call vbscript function c# , pass in object? e.x. in c# have object called adodb.connection rs there way call vbscript function displaydrillthrough(rs) so? i'm not familiar owc, but, yuriy's suggestion seems reasonable. try article: owc , ajax as fionnula mentioned, .dll may work. com interop library works in classic asp. the following links explain how build library , how convert datatable recordset building com interop library convert datatable recordset

javascript - Bxslider Images not loading until I refresh the Page? -

so have page have bxslider images inside tabs, have bxslider function set load before tabs when go tab bxslider images haven't loaded. when refresh page there. how them load when person goes tab there , not blank section? thanks! http://jsfiddle.net/r1ma11tj/ there lot of missing images, sorry i'm not sure how add images jsfiddles. here's live link at... http://morecleanenergy.com/graphics/testing/mass/mass.html this call function right before body tag. <script type="text/javascript"> $(document).ready(function () { $('.bxslider').bxslider(); $('#tab-container').easytabs(); }); </script> the bxslider on why cec page, has light blue background , it's second item top. /** * bxslider v4.1.2 - loaded, responsive content slider * http://bxslider.com * * copyright 2014, steven wanderski - http://stevenwanderski.com - http://bxcreative.com * written while drinking belgian ales , listening jazz

javascript - What *is* the ngModel.$validators pipeline? -

while performing basic research on custom client-side validation in angular.js, reading ngmodel.ngmodelcontroller documentation, , found following cryptic line: $setvalidity(validationerrorkey, isvalid); change validity state, , notifies form. this method can called within $parsers/$formatters. however, if possible, please use ngmodel.$validators pipeline designed call method automatically. a couple of hours , many google (and stackoverflow!) searches later, have found nothing ngmodel.$validators pipeline anywhere. custom validation examples use $parsers/$formatters setup below: link: function (scope, elem, attr, ctrl) { // other necessary logic... ctrl.$parsers.push(function () { // validation logic ctrl.$setvalidity('validation-type', true); }); ctrl.$formatters.push(function () { // validation logic ctrl.$setvalidity('validation-type', true); }); }, question: angular documentation stat

Comparing function types in F# -

the next test fail. call gettype directly function definition, , call gettype within inline function. generated types not equal. namespace poctests open fsunit open nunit.framework module helpers = let balance ing gas = ing - gas [<testfixture>] type ``reflected types`` ()= [<test>] member x. ``test type equality inline use`` () = let inline (=>) f = f.gettype().fullname, f in let fullname, fval = (=>) helpers.balance in helpers.balance.gettype().fullname |> should equal (fullname) how same type in order "comparable". when use function value, f# not give guarantees 2 created objects "same". under cover compiler creates new closure object each instance, false result when try this: balance.gettype().fullname = balance.gettype().fullname this intended behavior - when try comparing functions directly, compiler tell functions not satisfy equality constraint , cannot compa

How to manage fine grain permissions in Elasticsearch? -

i need store in consistent way role/groups can access information i'm not sure what's best way it. summary: have 2 kinds of docs "tweet" , "blog": at tweet level, store group name allowed access information blog more complex, there metadata ( title , description , nature , ...) of informations can restricted groups of user (only admin , or logged_in users) what best way map elasticsearch ? as of today, end documents like: /tweet/455 { id: 112, ugroups: [ "restricted_user", "admin" ], description: "foo", }, { id: 113, ugroups: [ "anonymous" ] description: "foo", } and /blog/500 { id: 5, fields: [ { "nature": { "value": "foo", "ugroup": [ "admin" ] } } ] } { id: 6, fields: [ { "comment": {

docx4j - xlsx4j to evaluate excel formulas -

provided xlsx4j satisfies spreadsheetml specs, can following scenario/requirement implemented using library? xlsx4j can read named ranges xlsx4j can evaluate formula defined in spreadsheetml specs xlsx4j can performs following loop: update named range var_a(let's variable in excel),evaluate formula-cells form_cell_a in uses named range var_a, read named range associated form_cell_a. regards i xlsx4j doesn't include code evaluating formulas. try apache poi that. if jaxb support important (thus making xlsx4j attractive you), port relevant poi code. (both projects aslv2 licensed)

java - Apache Tiles 2 : Set attribute value in child definition rendered ny parent definition template -

i want display <title> elements proper values in html pages. have 1 base layout jsp , corresponding tiles definition. i'd set value of <title> tag on per page basis, possibly in tile definition xml. so far have following tiles.xml: <definition name="base" template="/web-inf/jsp/layouts/base.jsp"> <put-attribute name="page-title" value="" /> </definition> <definition name="home" extends="base"> <put-attribute name="page-title" value="homepage" /> </definition> base.jsp: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%> <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title><tiles:insertattri

c# - How to configure in-memory unit testing of ASP.NET Web Api 2 OData service? -

this article presents elegant way of in-memory testing asp.net web api sites: instance of httpclient created using httpserver constructor argument, , after client's requests executed within same process. i trying achieve same odata service. compiled sample odata service using asp.net web api 2 odata classes, generated service reference in client project (and referenced web site project), test code doesn't communicate odata service. code: var ctx = new container(new uri("http://www.myservice.com/")); collectionassert.isnotempty(ctx.products); i can see it's making in-memory call container web site, doesn't reach odata service. missing configuration trick?

ruby - Converting a floating point to its corresponding bit-segments -

given ruby float value, e.g., f = 12.125 i'd wind 3-element array containing floating-point number's sign (1 bit), exponent (11 bits), , fraction (52 bits). (ruby's floats ieee 754 double-precision 64-bit representation.) what's best way that? bit-level manipulation doesn't seem ruby's strong point. note want bits, not numerical values correspond to. instance, getting [0, -127, 1] floating-point value of 1.0 not i'm after -- want actual bits in string form or equivalent representation, ["0", "0ff", "000 0000 0000"] . the bit data can exposed via arrays pack float doesn't provide functions internally. str = [12.125].pack('d').bytes.reverse.map{|n| "%08b" %n }.join => "0100000000101000010000000000000000000000000000000000000000000000" [ str[0], str[1..11], str[12..63] ] => ["0", "10000000010", "100001000000000000000000000000000000000000000000

javascript - Meteor.call() format js object into correct rest query -

i trying api call wordpress rest api. working call console looks this: http://dev.thomastraum.com/wp-json/posts?type=tt_works&filter[work_categories]= all&filter[posts_per_page]=1 a "handwritten" working call meteor looks this: return meteor.http.call("get", settings.wpdomain + "/wp-json/posts", {params: {'type':'tt_works','filter[work_categories]':'all','filter[posts_per_page]':'1'}}); now question is, how can pass javascript objects meteor call , end being in right format. me above calls should represented this: archivequery = { type:'tt_works', filter:{ work_categories:'all', posts_per_page:1 } }; but if pass return meteor.http.call("get", settings.wpdomain + "/wp-json/posts", {params:archivequery); it returns me posts type parameter of tt_works , ignores rest of query. tried ejson.stringify(archivequery) formats query differentl

Devise Rails 4 Error -

new rails app. simple followed https://github.com/plataformatec/devise now getting: nameerror: uninitialized constant user root@youplus:/var/www/html/youplus# rake db:migrate --trace ** invoke db:migrate (first_time) ** invoke environment (first_time) ** execute environment rake aborted! nameerror: uninitialized constant user /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.5/lib/active_support/inflector/methods.rb:238:in `const_get' /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.5/lib/active_support/inflector/methods.rb:238:in `block in constantize' /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.5/lib/active_support/inflector/methods.rb:236:in `each' /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.5/lib/active_support/inflector/methods.rb:236:in `inject' /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.5/lib/active_support/inflector/methods.rb:236:in `constantize' /usr/local/l

c++ - use environment variables in eclipse -

i have a eclipse cdt project using cross gcc toolchain. path of cross compiler has set in toolchain settings: c/c++ build -> settings -> cross settings -> path. because of sharing project other people, path cross compiler should in environment variable called linux_devkit_path. i defined linux_devkit_path environment variable , used "${linux_devkit_path}/bin" in c/c++ build -> settings -> cross settings -> path field. settings compiler couldn't found. tried used c/c++ build -> environment -> select... add variable list. environment variable found , appears in list origin user: config. in eclipse can set environment variables , values use when application runs. to set environment variables: in c/c++ projects view, select project. click run > run or run > debug. in configurations box, expand c/c++ local. select run or debug configuration. click environment tab.. do 1 of following: to create new environment variable,

many to many - r find one-to-one linkage between 2 cols -

i have dataframe this df <- data.frame(g1=c("x1","x2","x2","x3","x4"), g2=c("y1","y1","y2","y3",na), stringsasfactors = false) each row indicates x linked y of same row. how shall find how many x , y uniquely linked, not counting na? like in case, 1 unique linkage x3 y3. thanks. as understand question, you're looking rows of data frame g1 value , g2 value both unique. can check unique values in r duplicated function: subset(df, !duplicated(g1) & !duplicated(g1, fromlast=true) & !is.na(g1) & !duplicated(g2) & !duplicated(g2, fromlast=true) & !is.na(g2)) # g1 g2 # 4 x3 y3

Strange behaviour with xxf:format attribute in my Xforms form (using Orbeon Form Runner) -

i have numeric input field in form. add format on xxf:format : <xf:input id="input-control" bind="input-bind" class="question nombre" xxf:format="if (. castable xs:integer) replace(format-number(xs:integer(.),'###,###,###,###,###,###,###,###,###,##0'),',',' ') else ''"> this may bit wild it's format number 123456 presented 123 456. works great me, not users... now, added script cancel formatting when input focused (aka : go 123456 when editing field) simple js : <xf:action ev:event="domfocusin"> <xxf:script> var input = this.getelementsbytagname('input')[0]; var valeur = input.value.replace(' ',''); input.value = valeur; </xxf:script> </xf:action> behaviour looks ok @ first sight, mean, entered 123456, focus out , got 123 456 (format ok), focus in , got 123456 (scr

javascript - Angular ngRoute conditional .when() -

i'd implement conditional .when(), this: .when('/abc', { // if myservice.allow == true template: '<mydirec></mydirec>' // else redirectto: '/' }) my /abc route shall "secured" variable hold in 1 of services, in stateful manner. want set state somewhere else true/false , next time user tries /abc served conditionally. how can achieve this? - few 3rd-party dependencies possible what tried , read about: - injecting service in .config, learnt not possible - read using provider can injected. can use them use service? - template , templateurl accept function, didn't me thanks in advance! you use $routechangestart event. it's fired when url changed , takes current , next arguments like: $rootscope.$on('$routechangestart', function(event, next, current) { if (next === 'abc') // something; });

python - Django session id security tips? -

i'm developing site python + django , making login started using request.session[""] variables session user in, , realized when generates cookie "sessionid" in value every time user logs in, "c1cab412bc71e4xxxx1743344b3edbcc" , if take string , paste in cookie on other computer in other network , everything, can have acces session without login in. so i'm asking here if can give me tips of how can add security on system or if i'm doing wrong setting session variables? can give me suggestions please?

css - jQuery toggle colors of element on hover -

i have 2 words within div. 1 of words black, other grey. when hover on words, i'd colors swap on , again when hover out. so far here html markup: <div class="splash_logo"> <span class="paul">paul</span><span class="jones">jones.</span> </div> and css: .splash_logo { position:relative; font-family: helvetica,helvetica neue,arial,sans-serif; font-weight:bold; font-size:100px; float:right; margin-top:110px; } span.paul { color:#222222; } span.jones { color:#dedede; } and jquery hover event: $(".splash_logo").hover(function(){ $('span.paul').css("color", "#dedede"); $('span.jones').css("color", "#222222"); }); this change colours when hover over, however, how can them change when hover out? use :hover - css demo: span.paul:hover { color:#dedede; } span.jones:hover { color:#222222; } update: .splash_logo:hover

How to upload existing mongodb users into Meteor app? -

we have existing mongodb imported meteor app using: mongorestore -h 127.0.0.1 --port 3001 -d meteor dump/ mymongodb now seems can access collection find using collection name example: meteor.publish 'works', -> works.find({}, {limit: 10, sort: {createdat: -1}}) seems work, had collection named works. didn't have define it: @works = new meteor.collection('works') although wouldn't hurt define it. but lost when comes meteor.users collection. had collection in our database called users, cannot access one. how can our users collection other mongodb meteor.users app? ps. can access users collection directly terminal using 'meteor mongo' , search db.users.findone() cannot seem access code files. you need collections defined in order use them. meteor.users defined accounts packages (e.g. accounts-password ). if not using of packages, need define collection so: @users = new mongo.collection 'users' or @meteor.use

database - SQL complex contraints -

Image
i'm working on little database project , have problem organizing complex constraints data schema. here use bodyparttag describe accepted layertags in instance of bodypart. problem if i'm going build bodypart entity have no direct constraints associated bodyparttag. can create bodypart called 'red eyes' bodyparttag 'eyes' can attach bodypart layer if 'eyes' bodyparttag accepts 'left eye', 'right eye' layertags. how reorganize tables add these constraints? @ moment use 'programatic' solution requires coding seems not correct kind of tasks. details: white dot 1 , black dot many. you can composite keys rather surrogate keys. it's not necessary great way it, if working schema provide data constraint specified. firstly, add 'tag' keys primary keys of layer , bodypart tables, primary key composed of 2 values, i.e. layer table: pk_layer (id, layertagid) bodypart table: pk_bodypart (id, bodyparttag

Django no such table: project_forum? -

so i'm trying make forum django, keep getting operational error no such table: project_forum. code: list.html (/visdjango/visdjango/templates/list.html) <!-- forums --> <div id="list"> <table border="0" cellpadding="4" width="100%"> <tr> <td></td> <td>posts</td> <td>last post</td> <td></td> </tr> {% forum in forums %} <tr> <td {% if forloop.last %}class="last"{% endif %}> <div class="title"> <a href="{% url forum.views.forum forum.pk %}">{{ forum.title }}</a> </div></td> <td {% if forloop.last %}class="last"{% endif %}>{{ forum.num_posts }}</td> <td {% if forloop.last %}class="last"{% endif %}> {{ forum.last_post.short|linebreaksbr }}</td> <td {% if forloop.last %}class="last"{%

Joomla Component Develpment: JInstaller: :Install: Cannot find Joomla XML setup file -

i developed joomla component. got error while trying install it. "jinstaller: :install: cannot find joomla xml setup file" error path not have valid package. below myforms.xml file <? xml version = "1.0"encoding = "utf-8" ?> <extension type="component" version="3.2" method="upgrade"> <name>my forms!</name> <creationdate>sept 09 2014</creationdate> <author>toni ezeamaka</author> <authoremail>tons613@ymail.com</authoremail> <copyright>a-one globalsoft technologies</copyright> <version>1.0.1</version> <description>a component adding forms sites</description> <installfile>install.php</installfile> <uninstallfile>uninstall.php</uninstallfile> <scriptfile>script.php</scriptfile> <update> <schemas>

xcode - UIScrollView with UIButtons - Scroll View won't scroll when touch began on button -

i updated xcode 6 , ios 8 , noticed weird app. in app have scrollview several buttons within it, aligned horizontally. set create own custom scrollable tab bar controller. before update ios 8 , xcode 6 working perfect, realized when try scroll scrollview left or right, , initial touch within 1 of buttons in scroll view, no scrolling happens. if touch in-between buttons scrolling works expected. think it's issue button registering touch , if scrollview never got touched. 100% working before not going on!! i ended creating subclass of uiscrollview , set it's cancelcontenttouches value true , problem solved

c# - WebBrowser control won't navigate to URL when the call is via a timer -

i'm trying make app in c# integrated system.windows.controls.webbrowser . need implement functionality make periodic checks user activity , if user not active timespan, redirect browser control home page. below code snippet app. using system.timers.timer class periodically call checkuseractivity method, computes timespan , if timespan larger threshold, should redirect browser calling gohome method. unfortunately, won't work , behaviour seems rather strange me. added logging see happens (see below). "should go away soon" message shows ok, after browser doesn't naviagte home page , second message after call navigate doesn't show up. i absolutely no errors. works expected except call webbrowser's navigate method , call after vanished somehow. i suspect problem might have threads, have little experience c# have absolutely no idea problem might here. i tried rewrite code using system.threading.tasks.task library in same way mentioned @ http:

internet explorer - Import client certificate in IE with javascript -

Image
i trying import/install client certificate ie i'm getting following error in js code. function importclientcertificate() { try { var objcertenrollclassfactory = document.getelementbyid("objcertenrollclassfactory"); var objenroll = objcertenrollclassfactory.createobject("x509enrollment.cx509enrollment"); var spkcs7 = "-----begin certificate-----" + "miidadccamkccq..." + "-----end certificate-----" objenroll.initialize(1); //->this line causes exception objenroll.installresponse(3, spkcs7, 1, "correctpassword"); } catch (ex) { alert(ex.description); /*exception being thrown: certenroll::cx509enrollment::installresponse: access denied. 0x80070005 (win32: 5 error_access_denied)*/ } } what reason exc

javascript - Limit number files in jQuery-File-Upload -

i use plugin jquery-file-upload. how can limit of number selecting files local machine? https://github.com/blueimp/jquery-file-upload/wiki/options you can limit number of files before submitting adding onchange event input element. it's triggered check number of files. here simple example 2 file limit: <input type="file" onchange="if(parseint($(this).get(0).files.length)>2) alert('you can upload maximum of 2 files'); else alert('you within limit');" multiple/> see demo on fiddle here

google bigquery - oauth2client.client.AccessTokenRefreshError: invalid_grant Only in Docker -

i have same code same p12 file (checked md5 sums), same account_email, , same scope working on number of computers, not working in docker containers on of working computers. code snippet follows: with open(self.pkcs12_file_path, 'rb') f: key = f.read() scope = ['https://www.googleapis.com/auth/bigquery', 'https://www.googleapis.com/auth/cloud-platform'] credentials = signedjwtassertioncredentials(self.account_email, key, scope) http = httplib2.http() self.http = credentials.authorize(self.http) service = discovery.build('bigquery', 'v2', http=self.http) whenever try inside of docker container, oauth2client.client.accesstokenrefresherror: invalid_grant @ discovery.build line. i'm thinking might have needing expose ports, have no idea i'd need expose, or if that's actual problem. have ideas? this sounds clock issue. google's oauth access

javascript - jquery multiplication with broken numbers -

i coded price * qty function jquery not responding daily prices. response decimal numbers. here code; var qty = "3"; var price = "1.20"; var res = (qty*price); $("#boxres").html(res); they result 3.5999999999999996 i want 3.6 how can fix ? try $("#boxres").html(res.tofixed(1)); http://jsfiddle.net/dfz0bj3z/

PHP and Javascript WebSocket Confusion -

i have been looking on tutorials websockets, i'm confused how reply handshake. i've got code: protected function handshake($data, $socket) { $lines = preg_split("/\r\n/", $data); $headers = array(); if(!preg_match('/\aget (\s+) http\/1.1\z/', $lines[0], $matches)) { return; } $path = $matches[1]; foreach($lines $line){ $line = chop($line); if(preg_match('/\a(\s+): (.*)\z/', $line, $matches)) { $headers[$matches[1]] = $matches[2]; } } $seckey = $headers['sec-websocket-key']; $secaccept = base64_encode(pack('h*', sha1($seckey . '258eafa5-e914-47da-95ca-c5ab0dc85b11'))); $response = "http/1.1 101 switching protocols\r\n"; $response.= "upgrade: websocket\r\n"; $response.= "connection: upgrade\r\n"; $response.= &q

java - Change port number in JBoss EAP 6.0.1 -

can tell me can find default port number jboss eap 6.0.1 , how can change it? if there file can edit, prefer change in eclipse or something. i guess talking port http defaults 8080. can change in file jboss_home/standalone/configuration/standalone.xml .

javascript - Decelerate Meteor page rendering for helper function -

i want count position of table children using jquery in meteor js helper function, empty result, because helper function returns before table data gets inserted. here code: <table class="table"> <thead> <tr> <th>#</th> <th>game</th> </tr> </thead> <tbody> {{#each games}} {{> game}} {{/each}} </tbody> </table> <template name="game"> <tr> <td>{{counter}}</td> <td>{{name}}</td> </tr> </template> template.game.helpers({ counter: function() { return $('table.table tbody tr td:contains("this.name")').index(); } }); it should like: 1 test 2 abc 3 hellowo

swift - Bitwise operations with CGBitmapInfo and CGImageAlphaInfo -

i'm having trouble performing bitwise operations cgimagealphainfo , cgbitmapinfo in swift. in particular, don't know how port objective-c code: bitmapinfo &= ~kcgbitmapalphainfomask; bitmapinfo |= kcgimagealphanoneskipfirst; the following straightforward swift port produces cryptic compiler error 'cgbitmapinfo' not identical 'bool' on last line: bitmapinfo &= ~cgbitmapinfo.alphainfomask bitmapinfo |= cgimagealphainfo.noneskipfirst looking @ source code noticed cgbitmapinfo declared rawoptionsettype while cgimagealphainfo isn't. maybe has it? it doesn't official documentation on bitwise operators doesn't cover enums. you have right equivalent swift code: bitmapinfo &= ~cgbitmapinfo.alphainfomask bitmapinfo |= cgbitmapinfo(cgimagealphainfo.noneskipfirst.rawvalue) it's little strange because cgimagealphainfo isn't bitmask -- it's uint32 enum (or cf_enum/ns_enum type uint32_t , in c parlance),

Can you use global variables inside a t4 template? -

how can use global variables in tt file? if declare variable in header compile error if reference in function. <#@ template debug="false" hostspecific="false" language="c#" #> <#@ output extension=".cs" #> <# int valueforthisfile = 35; somefunction(); #> <#+ void somefunction() { #> public void generatedcode() { int value = <#=valueforthisfile#>; } <#+ } #> i know pass argument there hundreds of calls , syntactically tighter if avoid that. if 1 file hard code value there dozens of files have different settings , common include files generate code. thanks, john i don't think possible. when t4 parses template generating class. <# #> contents injected single method on class while <#+ #> tags added methods class, allowing call them single method <# #> tags. scope of "valueforthisfile" variable limited single method. simple exam

tomcat7 - How to set up a SQL Server Cartridge with Red Hat OpenShift? -

i have signed openshift online account , deployed basic tomcat 7 web application. interested in interacting sql server database, led believe supported database engine (at least wikipedia page http://en.wikipedia.org/wiki/openshift , few blog posts). however, have been unable figure out how add sql server cartridge, if 1 exists. would able supply basic instructions? if referring using mssql server, not available cartridge openshift online. need use runs on linux (mysql, mongodb, redis, etc). can, however, try signing dbaas provides mssql , connect openshift gear. if trying add mysql cartridge, log web console @ openshift.com, click on application, , click on "see list of cartridges can add" link near bottom of page. there presented list of cartridges can add existing application, such mysql, mongodb, phpmyadmin, etc.

entity framework - Locating Source of Migration -

i have project started using ef migrations. there initial migration , additional, hand-edited migration defines indexed views. there no other migration. i added single property 1 class. when create new schema, property created. however, cannot see why created, since property not mentioned in migration. if search entire source code folder (with subfolders, . ) mention of property name, not appear in ef migration code (it appears in class defined, , in few lines of code property accessed). when set breakpoint @ beginning , end of up() method 2 existing migrations, can see table created without additional property initial migration (verified in ssms), , property not yet exist @ end of last up() migration. sometime after control leaves last migration, code creates column in database additional property. to try , track down, hand-edited new property initial migration. now, after up() method last migration exits, sqlexception column names in each table must unique. c

sql - MySQL and get column headers where cell equals value -

i have sql table many columns (40+). first column id column , rest columns take values of 0 or 1. there query in can search row , see "cells" equal 1 , return column name? for example, id 5 , columns 4,9,23 each have 1 row (all others zero). therefore want return "column4","column9" , "column23" result. need id stipulation in there know row examine. any ideas? thanks!

c - L1 memory bandwidth: 50% drop in efficiency using addresses which differ by 4096+64 bytes -

i want achieve maximum bandwidth of following operations intel processors. for(int i=0; i<n; i++) z[i] = x[i] + y[i]; //n=2048 where x, y, , z float arrays. doing on haswell, ivy bridge , , westmere systems. i allocated memory this char *a = (char*)_mm_malloc(sizeof(float)*n, 64); char *b = (char*)_mm_malloc(sizeof(float)*n, 64); char *c = (char*)_mm_malloc(sizeof(float)*n, 64); float *x = (float*)a; float *y = (float*)b; float *z = (float*)c; when did got 50% of peak bandwidth expected each system. the peak values calculated frequency * average bytes/clock_cycle . average bytes/clock cycle each system is: core2: 2 16 byte reads 1 16 byte write per 2 clock cycles -> 24 bytes/clock cycle sb/ib: 2 32 byte reads , 1 32 byte write per 2 clock cycles -> 48 bytes/clock cycle haswell: 2 32 byte reads , 1 32 byte write per clock cycle -> 96 bytes/clock cycle this means e.g. on haswell i observe 48 bytes/clock cycle (could 2 reads in 1 clock cycle , 1 write