Posts

Showing posts from March, 2011

javascript - In form data, pass info about which button was clicked -- after confirmation modal -

the click event on submit button triggers confirmation modal. when user clicks on confirmation button, form sent without original submit button data, need. simplified code: <form action="/action" method="post"> <!-- inputs --> <button type="submit" name="foo" class="with-confirmation-modal" /> </form> <script> $(document).on('click', '.with-confirmation-modal', function() { $form = $(this).closest('form'); $modal = $('#modal'); $modal.on('click', 'button[type=submit]', function() { // form sent without info button // clicked prior modal $form.submit(); return false; }); $modal.modal('show'); return false; }); </script> what's way deal ? when post form clicking on <button type="submit" name="foo" /> data posted includes name of b

ruby - Wildcard route in Grape -

i'm having issues getting grape respond purely wild card route. by mean if have simple route defined get ... end i need respond potential requests made api. situation being need parse path , params , work through decision tree based on values. i've tried few variations on route definition, such as: get '/*' ... end '/(*)' ... end but no avail. i know there support regular expressions , route anchoring in grape, i've had no luck figuring out. thanks! you close guess @ syntax, need name matching param: e.g. '*thing' { :thing => params[:thing] } end using * make param capture rest of uri path, ignoring / separators. otherwise behaves other param. note pickup within rack mount point @ best, if have prefix 'api' version 'v2' then respond paths /api/v2/hkfhqk/fwggw/ewfewg if using custom 404 or other catch-all routes, need add @ end, otherwise mask more specific routes.

authentication - Ember.js REST Auth Headers -

i've been struggling long now. have expressjs server provides endpoint login. response has jwt token, expiring in hour. good. on emberjs side, can authenticate , token (using ember-simple-auth , ember-simple-auth-token). works protecting routes. can't life of me update restadapter headers include new authorization token. i've tried: using $.ajaxprefilter set authorization header. didn't work accessing "this.get('session.secure.token')" restadapter. thats undefined. please, if point me in right direction, i'd eternally grateful. need attach value in "session.secure.token" header restadapter requests. thanks you should able set simple-auth config property authorizer simple-auth-authorizer:token - in simple-auth code looks config property, looks simple-auth-authorizer:token , uses in combination ajaxprefilter . // config/environment.js env['simple-auth'] = { authorizer: 'simple-auth-authorizer:tok

node.js - NPM install from Github, ambiguous argument -

i trying install private github repo. first 3 private repositories install fine. final 1 errors out error shown below. have permission access, pull from, , push repo. have tried removing version number same error "ambiguous argument 'master'." other 3 repositories have same format install command. ps c:\users\shutez\documents\simple emotion\code\sedemo.tk> npm install git+ssh://git@github.com:simpleemotion/node-call -analytics.git#0.4.1 npm err! failed resolving git head (git@github.com:simpleemotion/node-call-analytics.git) fatal: ambiguous argument '0.4 .1': unknown revision or path not in working tree. npm err! failed resolving git head (git@github.com:simpleemotion/node-call-analytics.git) use '--' separate paths fro m revisions, this: npm err! failed resolving git head (git@github.com:simpleemotion/node-call-analytics.git) 'git <command> [<revision>...] -- [<file>...]' npm err! failed resolving git head (git@git

ruby - Count IP addresses -

i stored following ips in array: 10.2.3.1 10.2.3.5 10.2.3.10 - 10.2.3.15 i'm trying count total number of ip addresses. total number of ip addresses should 8. when iterate through array, total of 3 counts. need way count third item: 10.2.3.10 - 10.2.3.15 are there ip address counters? if need convert ip range, you'll need function converts ipv4 value integer, math on those: require 'ipaddr' def ip(string) ipaddr.new(string).to_i end def parse_ip(string) string.split(/\s+\-\s+/).collect { |v| ip(v) } end def ip_range(string) ips = parse_ip(string) ips.last - ips.first + 1 end ip_range("10.2.3.10 - 10.2.3.15") # => 6 that should it.

libalsa - How to list ALSA MIDI clients without reading `/proc/asound/seq/clients`? -

is there known way list existing midi clients using alsa api only, without reading special file /proc/asound/seq/clients ? i searched alsa midi api reference , , not find match. believe there must way achieve using api, otherwise that's lot surprising. as shown in source code of aplaymidi , similar tools, alsa sequencer clients enumerated snd_seq_query_next_client() : snd_seq_client_info_alloca(&cinfo); snd_seq_client_info_set_client(cinfo, -1); while (snd_seq_query_next_client(seq, cinfo) >= 0) { int client = snd_seq_client_info_get_client(cinfo); ... }

ios - Getting NULL value back in UITableView from SQLite database -

Image
program running without issue can see database being opened when add item app, shows null in uitableview i have unit tests test each action: create, update, delete, , count. these pass here unit tests: - (void)testtodoitemsqlite { nslog(@" "); nslog(@"*** starting testtodoitemsqlite ***"); todoitemsvcsqlite *todoitemsvc = [[todoitemsvcsqlite alloc] init]; todoitem *todoitem = [[todoitem alloc] init]; todoitem.itemname = @"this created unit test"; [todoitemsvc createtodoitem:todoitem]; nsmutablearray *todoitems = [todoitemsvc retrievealltodoitems]; nslog(@"*** number of todoitems: %lu", (unsigned long)todoitems.count); todoitem.itemname = @"this created unit test"; [todoitemsvc updatetodoitem:todoitem]; [todoitemsvc deletetodoitem:todoitem]; nslog(@"*** ending testtodoitemsqlite ***"); nslog(@" "); } this create , retrieve , update , , delete co

c# - Why I need ToList before GroupBy -

i creating api return cod_postal city make linked dropdown combos. i realize in db cod_postal duplicated. try remove using groupby was getting error until found sample working list. sample so decide first create list<dto> , perform group , solve duplicated problem code show. the question why need .tolist() join dto , groupby steps? public class cod_postaldto { public int cod_postal_id { get; set; } public string name { get; set; } } public class codpostalcontroller : apicontroller { private dbentities db = new dbentities (); public list<cod_postaldto> getcod_postal(int city_id) { list<cod_postaldto> l_cod_postal = db.cod_postal .where(c => c.city_id == city_id) .select(c => new cod_postaldto { cod_postal_id = c.cod_postal_id,

pi - My Java program isn't changing value of variable -

i learning java , decided create pi calculator, wrote in python , got working 14 d.p. the formula i'm using works calculating decimal part in infinite loop , adding 3 onto it. however i've brought java, doesn't see change the 'total' variable beyond '3.0' (this problem). know because can see code below displays total after every loop. here code: public class divider { public static void main(string[] args) { //declares variables boolean posorneg = true; double total = 3.0; long count = 0; long no1 = 0; long no2 = 1; long no3 = 2; double changer = 0; /begins loop { // sets value total value changed no1 =+ 2; no2 =+ 2; no3 =+ 2; changer = (4 / (no1 * no2 * no3)); if (posorneg == true) { total = total + changer; posorneg = false; } else {

mysql - Blank php page served by apache -

i installed apache, mysql, , php on machine in effort learn web development. until yesterday, had no problems configuration - working fine. this file structure /var/www/html/ info.php phptutorial/ index.php core/(more php) css/(more php) includes/(more php) apache working (status: running) , when navigate localhost in chrome see correct directory listing. when further navigate phptutorial/ directory, served blank page , cannot access index.php. yesterday page loaded fine. think it's configuration problem apache or php. file permissions on directories 755. any ideas? noticed strangely there no httpd.conf located in /etc/apache2/. userdir module enabled. uname -a; php -v; apache2 -v linux portege-r935 3.13.0-53-generic #89-ubuntu smp wed may 20 10:34:39 utc 2015 x86_64 x86_64 x86_64 gnu/linux php 5.5.9-1ubuntu4.9 (cli) (built: apr 17 2015 11:44:57) copyright (c) 1997-2014 php group zend engine v2.5.0, copyright (c) 1998-2014 zen

c# - How to convert binary data in Sql Server database back to image.used Memory Stream. It saved and now trying to retrieve from Sql Server -

private void btnsave_click(object sender, eventargs e) { sqlconnection con = new sqlconnection(connect.connectionstr); sqlcommand command = new sqlcommand(); sqldataadapter sda = new sqldataadapter(); try { con.open(); command.connection = con; if (txtfullname.text == "") { /// } else if (txtusername.text == "") { /// } else if (txtpassword.text == "") { // } else if (txtconfirm.text == "") { // } //else if (picstaffimage.image == null) //{ // messagebox.show("please upload image"); //} else if (cmbstationoptn.text == "") { // } e

java - Pointcuts on inherited methods (in a class design-agnostic context) -

i fiddling around aspectj , came idea don't seem able implement (story of life). i have defined aspect : package my.package; import org.aspectj.lang.annotation.*; import org.aspectj.lang.proceedingjoinpoint; @aspect public class myaspect { @pointcut("execution(* *(..)) && this(o)") public void instancemethod(object o) {} @pointcut("within(@marker *)") public void methodsfrommarkedclasses() {} @around("methodsfrommarkedclasses() && instancemethod(o)") public object markedmethodsadvice(proceedingjoinpoint joinpoint, object o) throws throwable { // awesome stuff return null; //<- not actual return, added head wouldn't hurt } } i have defined @marker annotation empty. the idea have advice markedmethodsadvice execute time method called on object of class marked @marker . (and here're tricky parts) : case 1 if said method inherited class not marked see example :

java - Convert Spring BindingResult to JSON? -

i'm trying export spring framework bindingresult object json send web client we're building. need list of errors: list<objecterror> getallerrors() unfortunately, seems have lot of self-referencing internal links result in jsonmappingexception error: com.fasterxml.jackson.databind.jsonmappingexception: infinite recursion (stackoverflowerror) (through reference chain: [snip] is there simple, "canned" way of doing or need write something? i'm not averse writing nice if there like: bindingresult.getallerrors().asjson();

Powershell Script assistance required -

i'm piping file's contents select-object , creating 2 properties each name, computername , fileexists , latter value result of test-path get-content c:\users\admin\documents\scripts\serverlist.txt | ` select-object @{name='computername';expression={$_}},@{name='folderexist';expression={ test-path "\\$_\c$\data\repository"}}, @{name='size';expression={$_.sum}} i want return size of folder if exists on each server. how ? tried adding @{name='size';expression={$_.sum}} to select-object not return value i think looking for get-content c:\users\admin\documents\scripts\serverlist.txt | select-object @{name='computername';expression={$_}},@{name='folderexist';expression={ test-path "\\$_\c$\data\repository"}}, @{name='size';expression={ "{0:n2}" -f ((gci -path "\\$_\c$\data\repository" -recurse | measure-object -property length -sum).sum /1mb) + " mb&quo

android - Adding View to Window Manager And Activity animation -

i have added button inside window. want open activity animating left when user taps on button. problem: first time when change activity , taps sliding animation dont works second time while on screen works fine. here code. if (basketflagview == null) { windowmanager = (windowmanager) activity.getapplicationcontext().getsystemservice(service.window_service); basketflagview = new basketflagview(activity); windowmanager.layoutparams params = getbuttonparams(activity); windowmanager.addview(basketflagview, params); }

python - How to upload data in model through migrations in django? -

i using django. made new model named suggestion_title has 2 fields named fa_id , desc. , have data in form of text filled in that. there way upload data migration or something. don't want add data manually. heard fixture not able find solution. please help. for older versions of django can use fixtures, versions >= 1.7, preferred way go data migration: https://docs.djangoproject.com/en/1.8/topics/migrations/#data-migrations # -*- coding: utf-8 -*- django.db import models, migrations def create_objects(apps, schema_editor): suggestiontitle.objects.create(fa_id="foo", desc="bar") class migration(migrations.migration): dependencies = [ ('yourappname', '0001_initial'), ] operations = [ migrations.runpython(create_objects), ]

java - How to generate A template function for all my variables in my class? -

i using eclipse rcp , rap developers version: kepler service release 2(32 bit) i have class looking this: public class builder { double booking_id; date beg_dt_tm; date end_dt_tm; boolean status_flag; string status_meaning; double encntr_id; double appt_type_cd; string appt_type_disp; string appt_type_display; double location_cd; string location_display; double sch_role_cd; string role_meaning; double primary_resource_cd; string primary_resource_display; long order_qual_cnt; list<order_qualsdo>order_qual = new arraylist<order_qualsdo>(); double sch_event_id; double schedule_id; long schedule_seq; } for want generate function this: public builder booking_id(double booking_id) { this.booking_id = booking_id; return this; } for variables in builder class . know how generate getters , setters, don't know if can generate custom made function definitions in eclipse these

javascript - angular ui-grid get name of column to be sorted -

how name of column supposed sorted? need pass information function gets data achieve external sorting. the sortcolumns variable in sort callback function gives access columns. you can name of field like: sortcolumns[0].field

c - Why does my code crash when I try to use input file with more than 100 edges? -

#include <stdio.h> #define graphsize 2048 #define infinity graphsize*graphsize #define max(a, b) ((a > b) ? (a) : (b)) int e; /* number of nonzero edges in graph */ int n; /* number of nodes in graph */ long dist[graphsize][graphsize]; long d[graphsize]; int prev[graphsize]; void printpath(int dest) { if (prev[dest] != -1) printpath(prev[dest]); printf("%d ", dest); } void dijkstra(int s) { int i, k, mini; int visited[graphsize]; (i = 1; <= n; ++i) { d[i] = infinity; prev[i] = -1; /* no path has yet been found */ visited[i] = 0; /* i-th element has not yet been visited */ } d[s] = 0; (k = 1; k <= n; ++k) { mini = -1; (i = 1; <= n; ++i) if (!visited[i] && ((mini == -1) || (d[i] < d[mini]))) mini = i; visited[mini] = 1; (i = 1; <= n; ++i) if (dist[mini][i]) if (d[mini] + dist[mini]

gruntjs - grunt-contrib-jade unable to read file (EISDIR) -

executing grunt jade:dev on this grunt.initconfig({ "jade": { "dev": { "files": { "cwd": "src", "src": ["**/*.jade"], "dest": "dist", "ext": ".html", "expand": true }, "options": { "pretty": true, "data": { "environment": "dev" } } }, "prod": { "files": { "cwd": "src", "src": ["**/*.jade"], "dest": "dist", "ext": ".html", "expand": true }, "options": {

Conditional group by join in R -

i new r , rather flumoxed following problem. have 2 vectors of dates (the vectors not aligned, nor of same length). i want find each date in first vector next date in second vector. veca <- as.date(c('1951-07-01', '1953-01-01', '1957-04-01', '1958-12-01', '1963-06-01', '1965-05-01')) vecb <- as.date(c('1952-01-12', '1952-02-01', '1954-03-01', '1958-08-01', '1959-03-01', '1964-03-01', '1966-05-01')) in sql write this, cannot find tips in how in r. select veca.date, min(vecb.date) veca inner join vecb on veca.date < vecb.date group veca.date the output should this: start end 1951-07-01 1952-01-12 1953-01-01 1954-03-01 1957-04-01 1958-08-01 1958-12-01 1959-03-01 1963-06-01 1964-03-01 1965-05-01 1966-05-01 here's possible solution using data.table rolling joins library(data.table) dt1 <- as.data.tab

symfony - Using a Factory to Create Services with symfony2.7 -

how use factory create services symfony2.7 ? #service.yml #in symfony 2.6 my.repository.photo: class: my\appbundle\repository\photorepository factory_method: getrepository factory_service: doctrine arguments: [my\appbundle\entity\photo] #i have errors deprecated: symfony\component\dependencyinjection\definition::setfactorymethod(getrepository) deprecated since version 2.6 , removed in 3.0. use definition::setfactory() instead. in /my/vendor/symfony/symfony/src/symfony/component/dependencyinjection/definition.php on line 137 deprecated: symfony\component\dependencyinjection\definition::setfactoryservice(doctrine) deprecated since version 2.6 , removed in 3.0. use definition::setfactory() instead. in my/vendor/symfony/symfony/src/symfony/component/dependencyinjection/definition.php on line 208 how use "setfactory" method in case ? docs: http://symfony.com/doc/master/components/dependency_injection/factories.html thanks! i think related docume

Lua: how to check whether a process is running -

i start process lua , monitor whether process still running. [edit] know starting can achieved os:execute, blocking. find way start process non-blocking , monitor whether still runs. one of blunt ways using io.popen() , monitoring it's output or processes them self using other linux tool ps . another way using lua posix bindings posix.signal , posix.unistd#fork()

How do I create efficient SQL select statements for any arbitrary model using Dapper in C#? -

i learned using select * inefficient , should not used in production code, i'm trying figure best way go creating sql select statements models. in case, there huge product entity in our database separated different tables, isn't, , i'm creating class represent table. have select table has ton of unnecessary columns don't need pull from, how dynamically create select statement selects columns need class? would idea create static method converts class's properties comma-separated list mapped class when query using dapper? maybe like: public static string getcolumnsasstring(type class);

cordova - ionic build android failure - Execution failed for task processDebugResources -

i using mac yosemite. getting following failure on running build android platform : failure: build failed exception. * went wrong: execution failed task ':processdebugresources'. > com.android.ide.common.internal.loggederrorexception: failed run command: /users/sairamk/development/android-sdk-macosx/build-tools/22.0.1/aapt package -f --no-crunch -i /users/sairamk/development/android-sdk-macosx/platforms/android-22/android.jar -m /users/sairamk/projects/dummy_app/platforms/android/build/intermediates/manifests/full/debug/androidmanifest.xml -s /users/sairamk/projects/dummy_app/platforms/android/build/intermediates/res/debug -a /users/sairamk/projects/dummy_app/platforms/android/build/intermediates/assets/debug -m -j /users/sairamk/projects/dummy_app/platforms/android/build/generated/source/r/debug -f /users/sairamk/projects/dummy_app/platforms/android/build/intermediates/res/resources-debug.ap_ --debug-mode --custom-package com.ionicframework.bcgsandbox553389 -0 ap

shell - Comment multiple lines in a file using sed -

i working on mac osx. writing shell script add prefix "//" log messages in file. wrote following sed script: sed -i '' "s|"log+*"|"//log"|g" filename the script working fine when log message has single line. if log has multiple lines fails. eg: log("hi how you"); the output comes out : //log("hi how you"); but, want output be: //log("hi // how // you"); since haven't used sed don't know how this. so, possible using sed. if yes how? thanks the simplest method use address ranges sed "/^\s*log.*;$/ s|^|//|; /^\s*log/, /);$/ s|^|//|" input what does? /^\s*log.*;$/ s|^|//| if line starts log , ends ; substitute start, ^ // /\s*^log/, /);$/ s|^|//|" /^log/, /);$/ address range. lines within range, substitution performed. range of lines start first regex match end match. t

Unable to click the Search(magnifying glass) button in Android keyboard using Appium/Selenium/Java -

i unable select search button on android keyboard 1 magnifying glass using appium/selenium , java . have gone through earlier threads on stackoverflow , none of threads helpful. need expert help! thanks! you can use use search button on keyboard: driver.sendkeyevent(androidkeycode.enter);

pdfium DLL on Android wrapper dll -

it possible use pdfium dll on project android? there way wrapper dll use in android?what best solution? need way wrapper pdfium use in project android somebody wrapped pdfium library use in android. please check https://github.com/mshockwave/pdfiumandroid .

animate.css - owl-carousel caption animated -

i want animate div.caption>div fadein effect every time click on next button. i've added wow.js , animate.css add effects. now, want animate divs have .wow class. problem see first effect. others works fine don't see because effects starts @ same time, , want effect start in item. http://jsfiddle.net/masfi/hpw4tuz7/5/ the code use: <div id="owl-demo" class="owl-carousel owl-theme"> <div class="item" > <div class="caption"> <div class="fadein wow" data-wow-delay="0.1s"> <p>111</p> </div> <div class="fadein wow" data-wow-delay="0.2s"> <p>222</p> </div> </div> <img src="http://owlgraphic.com/owlcarousel/demos/assets/owl3.jpg" alt="" /> </div> <div class="item"> <div class="caption">

Android - Display all images from server folder using PHP in GridView -

Image
i trying capture image or record video using camera , upload server. on server side, used php language read file , moved particular location. want display these images stored server. please me. this upload image php script <?php // path move uploaded files $target_path = "uploads/"; // array final json respone $response = array(); // getting server ip address $server_ip = gethostbyname(gethostname()); // final file url being uploaded $file_upload_url = 'http://' . $server_ip . '/' . 'androidfileupload' . '/' . $target_path; if (isset($_files['image']['name'])) { $target_path = $target_path . basename($_files['image']['name']); // reading other post parameters $email = isset($_post['email']) ? $_post['email'] : ''; $website = isset($_post['website']) ? $_post['website'] : ''; $response['file

recursion - Java Recursive Method ArrayList is not adding all child elements to the final ArrayList -

i writing recursive method traverse hierarchy of java objects. purpose wrote recursive method takes root node(parent) parameter. here base method calls recursive method traverse: if (category.id == gallerie_id_test) { traverse(category); system.out.println("children ...." + subcategories); } and in traverse method wrote logic traverses child nodes of parent node. when add child objects arraylist, children not getting added final list method. returning child count of parent node need child nodes of subsequent nodes too. here code goes: private static void traverse(kalturacategory category) throws kalturaapiexception { list<kalturacategory> subcategories = new arraylist<kalturacategory>(); kalturacategorylistresponse categorieslist = null; if (category != null && category.directsubcategoriescount >= 1) { kalturacategoryfilter filter = new kalturacategoryfilter(); f

wso2 bps human task can I set deadline for a task to be completed -

as @ samples of human task deadline sample, sets deadline when owners should start task. after task created deadline, system create timer based on task created time plus deadline delta. in situation, need set deadline when task should completed. absolute time. how can it? try sample [1]. if sample doesn't fit scenario, @ deadline syntax [2] change according that. should able this.. [1] http://tryitnw.blogspot.com/2013/05/escalating-human-task-with-wso2-bps.html [2] http://docs.oasis-open.org/bpel4people/ws-humantask-1.1-spec-cs-01.html#_toc135718795

javascript - Node+Express Post Error -

i trying post fields form lista[0].usuario seems empty in jade page. i using: node version v0.12.3000 express 3.20.3 --my code-- ---app.js--- var express = require('express'); var routes = require('./routes'); var http = require('http'); var path = require('path'); var app = express(); var v_login = require('./routes/login'); // environments app.set('port', process.env.port || 3000); app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'jade'); app.use(express.logger('dev')); app.use(express.json()); app.use(express.urlencoded()); app.use(app.router); app.use(express.static(path.join(__dirname, 'public'))); // development if ('development' == app.get('env')) { app.use(express.errorhandler()); } app.get('/login', v_login.login); app.get('/login', v_login.get_enviar); app.post('/login', v_login.post_enviar); http.

android - Cast image (photo) to Chromecast -

i'm following these ( 1 , 2 ) guides create sender android application chromecast , i'm interested in sending pictures. there lot of informaton , samples how cast text , audio , video . not single word how pictures . i belive in power of stackoferflow , should've faced such problem. please give sample or tutorial. need guide cast fullscreen picture using media router , features. thats how sending text message using custom channel: /** * send text message receiver */ private void sendmessage(string message) { if (mapiclient != null && msmartbuschannel != null) { try { cast.castapi.sendmessage(mapiclient, msmartbuschannel.getnamespace(), message) .setresultcallback(new resultcallback<status>() { @override public void onresult(status result) { if (!result.issuccess()) { log.e(

java - If it safe to return an InputStream from try-with-resource -

this question has answer here: try-with-resources , return statements in java 2 answers is safe return input stream try-with-resource statement handle closing of stream once caller has consumed it? public static inputstream example() throws ioexception { ... try (inputstream = ...) { return is; } } it's safe, closed, don't think particularly useful... (you can't reopen closed stream.) see example: public static void main(string[] argv) throws exception { system.out.println(example()); } public static inputstream example() throws ioexception { try (inputstream = files.newinputstream(paths.get("test.txt"))) { system.out.println(is); return is; } } output: sun.nio.ch.channelinputstream@1db9742 sun.nio.ch.channelinputstream@1db9742 the (same) input stream returned (same reference

sendkeys - On-Screen Keyboard hide and run within excel instance to use functionality -

to give brief backstory bring things current position / reason question: i wanted use sendkeys send keyboard presses citrix xenapp remote terminal application (vt320 emulator). this not work. after investigation became apparent has been reasonably common issue. i found work-around involved opening windows 'on-screen keyboard' application , sending mouseclicks using vba osk app itself. key transmissions received in remote terminal application. this solution rather awkward , not practical solution relies on many factors e.g. screen resolution, co-ordinates / current position of osk etc. with above in mind, looking achieve more full proof method , here's thoughts: rather using simulated mouseclicks ideally able either 'embed' osk app excel instance , reference each key or hide app , find way make application receive vba keys requested. i'm aware sendkeys has limitations have tried using sendinput via keyb_event , didn't work. to hal

Upload excel file in MYSQL using PHP -

i want upload excel file mysql table without using pdo, simple mysql connection. i want load excel file using domdocument::load can't work. here's i've tried far: mysql_connection("localhost", "root", ""); mysql_select_db("excel"); function add_data($abc, $pqr, $xyz) { $str = "insert excel(abc, pqr, xyz) values('$abc', '$pqr', '$xyz')"; $qry = mysql_query($str); } if (isset($_files['file'])) { $dom = domdocument::load($_files['file']['tmp_name']); $rows = $dom->getelementsbytagname('row'); $first_row = true; foreach ($rows $row) { if (!$first_row) { $abc = ""; $pqr = ""; $xyz = ""; $index = 1; $cells = $row->getelementsbytagname('cell'); foreach ($cells $cell) { $ind = $cell->getattribute(

javascript - Making Meteor to exclude certain JS files for anonymous users -

what best approach when there's need to: deploy meteor.js app meteor.com and exclude js files being bundled , accessed anonymous users so far i've understood possible via placing files in question in public folder , conditionally loading them. is there possibility, namely 1 allow keeping files needed loaded conditionally in client/templates. thanks much! jussi meteor intends send code client in it's build bundle. being said, public , conditionally apply method works, or can write code allows functions ran people logged in. if you're using meteor accounts package, that's simple as if(meteor.user){ //logged in } else { //not logged in }

avr - Why I am always getting Zero PWM output? -

i want output 2 different analog values 10 bit resolution i.e. dac_value ranging 0-1023. using atmega16 external crystal 4mhz. have tried connecting rc filter @ output nothing changed. getting 0 output, can ?? #include <avr/io.h> #include <avr/interrupt.h> void initpwm() { tccr1a |= (1<<wgm11) | (1<<wgm10) | (1<<com1a1) | (1<<com1a0) | (1<<com1b1) | (1<<com1b0) ; tccr1b |= (1<<wgm12) | (1<<cs10); } uint16_t dac_value1 = 100, dac_value2 = 200; int main(void) { initpwm(); while(1) { ocr1a = dac_value1; ocr1b = dac_value2; } (;;) {} } you assigning wrong bits wrong registers. clarify: pwm not analog output. changed high or low output state. pwm value determines how long output in each state (high or low) withing timer period. if want make "analog" output, need filter output signal, example, passing thru rc-filter, need make output fast possible, that'

Spring Integration Java DSL - @ServiceActivator method with @Header parameter annotations -

i have spring integration 4 bean method following signature: @component public class aservice { @serviceactivator public message<?> servicemethod( message<?> message, @header(serviceheader.a_state) astate state, @header(serviceheader.a_id) string id) { ... } ... } at moment, call service method within spring integration java dsl (spring-integration-java-dsl:1.0.1.release) flow this: .handle("aservice", "servicemethod") this works absolutely fine but, wondering whether possible call service method in following sort of way: .handle(message.class, (m, h) -> aservice.servicemethod(m, h)) the reason call service method in sort of manner that, when looking @ code using ide such eclipse, can drill service's method example highlighting method , pressing f3. so question is, there alternative way calling @serviceactivator method (which includes @header annotations) without us

mysql - if condition inside a sql query -

following part of stored proceedure im using extract data db. query begin set @sqlstring = concat("select b.id, c.name, c.accountid,, b.total_logs, a.time_start, a.time_end ,count(a.id) number_of_users ",logtable," inner join users b on a.id = b.id inner join accounts c on b.accountid = c.accountid group id;"); prepare stmt @sqlstring; execute stmt; end at times in db, logtable(table passed in variable logtable_1, logtable_2 .... ) can non existent, when perticuler table missing crashes , throws error because a.time_start, a.time_end cannot have values without log table. but want assign null on values a.time_start, a.time_end without throwing error, so can body tell there way modify code like begin if logtable exists \\ query else \\ query end find existence of table querying information_schema.tables . if returns count equals 1 can proceed executing query on table. otherwise go else block. sample : declare tab

javascript - Why does my directive lose $event? -

i have custom directive confirm if user clicks element wants perform action: .directive('ngreallyclick', ['$modal', function ($modal) { return { restrict: 'a', scope: { ngreallyclick: "&", }, link: function (scope, element, attrs) { var isdeletedisabled = scope.ngreallydisabled; element.bind('click', function () { if (isdeletedisabled != true) { var message = attrs.ngreallymessage || "are sure ?"; ... var modalinstance = $modal.open({ template: modalhtml, controller: modalinstancectrl }); modalinstance.result.then(function () { scope.ngreallyclick({ ngreallyitem: scope.ngreallyitem }); //raise e

jquery - Lookup field load all items -

i having 1 sharepoint custom list. having 2 lookup fields. using spservices.cascading drop down filter second drop down first drop down. each lookup list having around 4000 items. problem there when open new form of list takes time load because loads items lookup list. can somehow stop behavior , load no data in second lookup field when new form load first time?

linux - P4API.cpp:39:20: fatal error: Python.h: No such file or directory -

getting fatal error while installing p4python on linux machine. configuration: python 2.7.5 os : fedora below message getting while installing "p4python": $ pip install p4python creating build/lib.linux-x86_64-2.7 copying p4.py -> build/lib.linux-x86_64-2.7 running build_ext building 'p4api' extension creating build/temp.linux-x86_64-2.7 gcc -pthread -fno-strict-aliasing -o2 -g -pipe -wall -wp,-d_fortify_source=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -d_gnu_source -fpic -fwrapv -dndebug -o2 -g -pipe -wall -wp,-d_fortify_source=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -d_gnu_source -fpic -fwrapv -fpic -did_os="linux31x86_64" -did_rel="2015.1.main" -did_patch="1058604" -did_api="2015.1/1054991" -did_y="2015" -did_m="05" -did_d="12" -i/tmp/p4api-201

ios - Creating multiple views programmatically -

hello ask how create multiple views programmatically , show them on screen, have tried there missing. int x,y; x= 0; y=50; (int i=0; i<4; i++) { uiview *view = [[uiview alloc] initwithframe:cgrectmake(x, y, 300, 100)]; view.backgroundcolor = [uicolor redcolor]; [self.view addsubview: view]; y+=40; } int x,y; x= 0; y=50; (int i=0; i<4; i++) { uiview *view = [[uiview alloc] initwithframe:cgrectmake(x, y, 300, 100)]; view.backgroundcolor = [uicolor redcolor]; view.layer.cornerradius = 5.0f; [self.view addsubview: view]; y+=140; //y next view should height of previous view , margin between view }

c# - Modifying Entity Framework Entities from Multiple Threads -

Image
i have ui thread enables user set properties of entity. i have worker threads automatically modify properties of entity that, importantly, user not have access to. would safe have different dbcontexts per thread , depend on programming avoid modifying same property , attempting savechanges() on context has same entity modified in different ways? or there safer way of doing this, i.e. way in possible programmer day change code such same property modified 2 different contexts safely? or latter situation 1 programmer has careful/refactor around? theoretical part there three ways resolve concurrency issues in multi-threading environment: pessimistic , can done locks item being edited - no 1 else can edit item being edited. hard implement approach, , way quite bad performance view - editing threads waiting single writer, , wasting system resources. optimistic , default way resolve issues. main idea continue operation until have success. there lot of algorithm in

windows installer - What is wrong with this 'run executable' Wix xml code? -

i trying execute my.exe using your.exe . it's not working expected. here code snippet: <?xml version="1.0" encoding="utf-8"?> <wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <product id="*" name="my_name" language="1033" version="1.11.5164" manufacturer="company" upgradecode="put-guid-here"> <package description="test file in product" comments="simple test" installerversion="200" compressed="yes" /> <media id="1" cabinet="simple.cab" embedcab="yes" /> <directory id="targetdir" name="sourcedir"> <directory id="programfilesfolder" name="pfiles"> <directory name="my_folder" id="my_folder"> <compone