Posts

Showing posts from July, 2010

c# - objectdatasource not always firing select function -

i writing query issue having object datasource control .in following link similar issue been discussed not same . objectdatasource.select() not firing on page postback in case not resolved solution mentioned there ( gridview.databind ) problem: in project ui pages(aspx or ascx) pages calls dal manager functions 1 of function selecttasks(int userid) assigned selectmethod of objectdatasource control. reason have call selecttasks function of object datsourcecontrol below . objectdatasourceselecttasks.selectparameters.item("userid") = textboxuserid.text ienumerator = objectdatasourceselecttasks.select.getenumerator() and convert enumerator value list . i have kept debug point @ dal function debug point not hit. same record if try debug step step i.e objectdatasourceselecttasks.select here if press f11 working. how can resolved ? thanks in advance we not find answer 1 , workaround have called directly dalmanager function . dim myobject a

php - bind_param not working (on a non-object) mysqli prepared statement -

i have read 15 posts on here far regarding issues none of have been able me. i have following code: $stmt3 = $mysqli->prepare("select cc.name, cc.company, cc.email (`case_contacts` cc) cc.case_id=? , cc.end_date null"); if (is_object($stmt3)) { $stmt3 -> bind_param("i", $case_id); } else { die('connection issue'); } $stmt3 -> execute(); $stmt3 -> bind_result($name, $company, $email); while ($stmt3->fetch()) { when execute advises "connection issue". before $stmt3 can var_dump $mysqli quite happily. i have manually entered query both phpmyadmin , online query checker , both confirm valid. i have checked permissions of user, fine. in fact in process of re-writing queries mysql mysqli , wantedto use prepared statements. database user same. have had no issues other prepared statements more complex @ loss missing. i have overkilled '`' quote wrap on statement know should on every query! any advice,

zshrc - Why doesn't incremental history search work in zsh? -

i'm trying rid of oh-my-zsh , biggest challenge getting incremental history search working. i've acked , grepped way through code , there's no clues in site. error : no such widget 'histrory-beginning-search-backward' edit: i've tried absolute least possible code, still doesn't work. here's reduced test case: # key bindings bindkey -v function zle-line-init zle-keymap-select { rps1="${${keymap/vicmd/normal}/(main|viins)/insert}" rps2=$rps1 zle reset-prompt } zle -n zle-line-init zle -n zle-keymap-select bindkey -m vicmd '^r' histrory-beginning-search-backward bindkey -m viins '^r' histrory-beginning-search-backward here's config, taken zsh config wizzard, current zshrc , oh-my-zsh: autoload zkbd # following lines added compinstall zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate zstyle ':completion:*' matcher-list 'm:{a-za-z}={a-za-z}' 'r

android - Getting file path from uri on emulator -

i want file path uri video. following method works fine when testing real device, however, fails (returns null) when testing on emulator. public string getrealpathfromuri(context context, uri contenturi) { cursor cursor = null; try { string[] proj = {mediastore.video.media.data}; cursor = context.getcontentresolver().query(contenturi, proj, null, null, null); int column_index = cursor.getcolumnindexorthrow(mediastore.video.media.data); cursor.movetofirst(); return cursor.getstring(column_index); } catch (exception e) { e.printstacktrace(); } { if (cursor != null) { cursor.close(); } } return null; } what correct way of getting file path uri on emulator? the following method works fine when testing real device only on the device tried, , app tried. particularly on android 4.4+, approach unreliable.

javascript - Unable to createWriteStream to save downloaded file -

i have function in nw.js app downloads bunch of files server , saves them in folder chosen user names sent server. not know names of files in advance - urls using randomly-generated strings have gotten server, , server looking each hash see file corresponds to. var regexp = /filename=\"(.*)\"/gi; media_urls.foreach(function(url) { var req = client.request(options, function(res) { var file_size = parseint(res.headers['content-length'], 10); var content_disposition = res.headers['content-disposition']; var name = regexp.exec(content_disposition)[1]; var path = path.join(save_dir, name); var file = fs.createwritestream(path); file.on('error', function(e) { console.log(e); req.abort(); }); res.on('data', function(chunk) { file.write(chunk); }); res.on('end', function() { file.end(); });

C# Sorting words from xml file to text file in alphabetical order -

i’m working on c# program converts contents of xml document txt file , i’m struggling on adding conditions inputting words in ascending order of size. have entered condition prevents lowercase words being entered , know if either similar method can used return words in alphabetical order or if isn't possible, alternative. condition no lowercase letters followed: internal static bool nolowercase(string words) { return words.all(c => c >= 'a' && c <= 'z'); } you're title threw me off first time, thought wanted in alphabetic order. should sort list length. var sorted = s in e orderby s.length ascending select s; return sorted; http://www.dotnetperls.com/sort-strings-length

opencl - Fast algorithm for compacting a buffer -

i performing image compression. the image i broken k code blocks {bi}. each block has fixed size mxn pixels. each block independently compressed. all compressed blocks {ci}, compressed sizes {pi}, stored in linear buffer b , of size k * m, m fixed size greater sizes pi. now, pack buffer b buffer c , , rid of empty space @ end of each compressed code block ci. so, need kernel will: for each block ci, find sum of pk k < i, (call offset_i) copy data each ci, b c , @ offset_i, of size pi any ideas on how appreciated!! here code snippet, (i suppose) stream compaction. contains tons of arithmetic, can parallelized desired measure. #include <time.h> #include <stdio.h> #include <stdlib.h> typedef struct block { int size; int buf[8]; } block; typedef struct blockpos { int t_size; //temporary size compaction int f_size; //actual size int pos; //position } blockpos; int main() { const int num_blocks = 16;

SQL Server - Foreign Key constraint may cause cycles or multiple cascade paths -

Image
here's database notification system (it has been stripped down simplicity). when user deleted want related notification , useremail deleted constraint may cause cycles or multiple cascade paths error when try set relationship on delete cascade. unable create relationship 'fk_notification_targetuser'. introducing foreign key constraint 'fk_notification_targetuser' on table 'notification' may cause cycles or multiple cascade paths. specify on delete no action or on update no action, or modify other foreign key constraints. not create constraint or index. see previous errors. after doing research possible solutions are: add instead of delete trigger user table , manually delete child tables. redesign tables suggested here: foreign key constraint may cause cycles or multiple cascade paths? i'm not quite sure in case. do logical/soft delete. (recommended in comments) any recommendations should do? additional resources: implementing r

javascript - Changing focus to an element on click -

problem: i have top arrow .fa-caret-up @ bottom of page, looking change focus after arrow clicked either window or logo .logo @ top left corner of page. where i'm at i see console.log("does work?") when tab it's not in normal tab order , takes me "leaving html content" in mac screen reader. scripts.js $(function() { // plays videos on click, beautiful $("video").click(function (e) { if(e.offsety < ($(this).height() - 36)) // check see if controls clicked { if(this.paused) this.play(); else this.pause(); } }); // smooth scroll butter $('a[href*=#]:not([href=#])').click(function() { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { $('html,body&#

c - copy one string in to other using pointer produce Garbage values why? -

if take array fine used *str1 , str2 not work #include <stdio.h> void copystr(char* ,char*); int main() { char *str1="xxx"; char *str2= "yyy"; copystr(str1, str2); printf("\n %s",str2); } void copystr(char *dest,char *src) { while(*src!='\0') *dest++=*src++; *dest='\0'; return; } char *str = "some string" here str pointer pointing constant memory, can't edited , leads undefined behaviour. but if declare like char str2[] = "some string" now str2 above pointing memory not constant , can changed. work. more explanation here: char *array , char array[]

Image renders in browser address bar, but not in HTML image tag -

i have html test page following image tag: <img src="http://media.kohls.com.edgesuite.net/is/image/kohls/2021314?wid=130&amp;hei=130&amp;op_sharpen"> when open test.html in web browser, image not render. instead, shows broken image link icon. http://media.kohls.com.edgesuite.net/is/image/kohls/2021314?wid=130&hei=130&op_sharpen but if paste url of image directly browser address bar, displays image without issue. know how can display image in <img> tag? problem seems occur images kohl's department store. open graph image 1 of products (og:image). i have tried replacing &amp; codes & , did not solve anything. the problem server expecting literal &amp; instead of usual & delimit fields. in html, need escaped: <img src="http://media.kohls.com.edgesuite.net/is/image/kohls/2021314?wid=130&amp;amp;hei=130&amp;amp;op_sharpen"> which gives: http://media.kohls.com.edgesuite.net/i

javascript - point free where arguments are in the wrong order -

i want write function using ramda's standard function set given dictionary , key, increment value key. example fn('foo', {}) // => {foo: 1} fn('foo', {foo: 1}) // => {foo: 2} i've gotten pretty close missing way curry properly. i have method takes key , object , returns 1 more: // count :: -> number var count = r.compose(r.inc, r.defaultto(0)) // countprop :: string -> object -> number var countprop = r.curry(r.compose(count, (r.prop(r.__)))) countprop('foo', {foo:1}) // 2 countprop('foo', {}) // 1 now want return new data structure // accum :: string -> object -> object var accum = r.curry(function(key, obj){ return r.assoc(key, countprop(key, obj), obj) }) accum('foo', {foo: 1}) // => {foo: 2} but issue in order make point free, have figure out how values in functions setup curried in proper order. doing wrong? should set function differently? tried set both dependent functions both take ke

php - Issues with returning Array from Connection Class -

i having issue returning array. this part of connection class. public function createdataset($incomingsql) { $this->stmt = sqlsrv_query($this->conn, $incomingsql); if ($this->stmt) { $this->rows = sqlsrv_has_rows($this->stmt); if ($this->rows) { while($this->row = sqlsrv_fetch_array($this->stmt, sqlsrv_fetch_numeric)) { $this->myarray[] = $this->row; } } return $this->myarray; //$this->result = $this->row; //return $this->result; } } and how calling on page... $conn3 = new connectionclass; $mydataset = $conn3->createdataset('select top (100) city, state, postalcode store'); echo $mydataset[0]; i using echo test. the $mydataset echoing nothing. can see $myarray fill 100 records when debug, not return it..

How to create a Java Map<String,String> with unmodifiable keys? -

in java, how should create map<string,string> has unmodifiable keys, while keeping values modifiable. i'd hand map<string,string> through interface else add/change map values, not able change map keys. the background on higher level problem have list/set of variable names (with tree structure) (represented java string) i'd code on other side of java interface able populate aliases (also strings) each of variable names. i'd have multiple implementations of interface naming tree hierarchy can aliases different ways fit different situations. having interface implementation populate map<string,string> bunch of keys set-in-stone (and maybe containing defaults values) , allowing modify values (but not keys), seems best approach. i'm creating mapping between names , alias, map<> makes sense. back lower level problem. i'd code resemble: public class myclass { public interface imymapper { void build(

Import less files within the scope of a mixin -

im researching while now, cant figure out. @theme: 'example'; // works @import (reference) "../themes/@{theme}"; .import(@theme) { // doesn't work @import (reference) "../themes/@{theme}"; } i guess mixins called @ "end" of compiling process, cant import there because needs variables earlier. is there known hidden secret workaround this? this code .import(@theme) { // doesn't work @import (reference) "../themes/@{theme}"; } .import(hello); failed because of syntaxerror: variable @theme undefined in less/capsule.less on line 33,

encryption - MD5Hash encrypt a list of emails via terminal for an outside vendor -

i have list of emails in txt file vendor requesting md5hash encrypted. understanding md5hash isn't encryption i'm unsure how this. is there terminal command take txt file , md5hash every single email in file "encrypted"? the terminal command know regarding md5hash , result when md5hash file below: md5 -r /users/me/desktop/test_file.txt result is: 0240da8148f06ae774de0831eda20eee /users/me/desktop/test_file.txt anyone know of method (i guess) md5hash every single email in file? there 20k emails, doing each 1 individually isn't option. or misunderstanding how md5hash should used email list? , fyi i'm using terminal on mac. thanks! i guess don't want transport plain text emails. later compare hashes of emails file. for examle emails.txt: a@a.com b@b.com c@c.com d@d.com command writes md5-s of each e-mail new file: cat emails.txt | while read line; echo -n $line|md5; done >> emailsmd5.txt if have file containi

javascript - Refer to common values within an object -

i have object nested objects have same variables within nested objects properties. i'm trying make code more dry consolidating common variables property of nested object, i'm not sure if correct or best way write it. have thoughts? usage i'm calling various functions callbacks jquery each/onclick statements. $('#foo').each(foo.part1.begin); $('.bar a').on('click', foo.part1.middle); in case i'm using .each , i'm appending data attributes tracking in analytics tool i.e. when user clicks link, sent attributes. in case i'm binding event, i'm sending special analytics tag custom event. i've updated first property begin in foo object illustrate i'm doing. have utilities library function takes $this , object, function loops through object , sets of atttributes on anchor tag, etc. current implementation: var foo = { part1: { begin: function () { var $this = jquery(this), na

Intel XDK HTML5 + Cordova Adjust Brightness -

i'm having trouble adjusting brightness in intel xdk html5 + cordova. have imported phonegap/cordova plugin @ https://github.com/fiscal-cliff/phonegap-plugin-brightness still not anything. advice apperciated! here code: <script src="intelxdk.js"></script> <script src="cordova.js"></script> <script src="xhr.js"></script> <script src="xdk/init-dev.js"></script> <script type="application/javascript" src="lib/jquery.min.js"></script> <script type="application/javascript" src="jqm/jquery.mobile-min.js" data-ver="0"></script> <script type="application/javascript" src="js/app.js"></script> <script type="application/javascript" src="js/init-app.js"></script> <link rel="stylesheet" media="screen" type="text

C# Printing ArrayList Containing Multiple Values -

i'm new arraylist. far know arraylists each element(?) can contain multiple values (excuse me not using correct terminology). now, here's problem, if make arraylist each element contains 1 value, can print it, in example below, if attempt make arraylist each element contains multiple values - cannot print values of each element in arraylist. if try use foreach or loop using console.writeline(list[i]); namespace. using system; using system.collections; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; namespace consoleapplication13 { class register { public string name; public string surname; public void registerdata() { console.write("enter name: "); name = console.readline(); console.write("enter surname: "); surname= console.readline(); } public void printdata() { console.writeline("name: " + name + " surname: " + surname

jquery-datatables-rails not showing up after a link_to but does other times -

i trying jquery-data-table in rails 4.0 (ruby 2.2) work. in strange way does. if goto index view in groups controller (snippet): <%- model_class = group -%> <div class="page-header"> <h1><%=t '.title', :default => model_class.model_name.human.pluralize.titleize %></h1> </div> <!-- table class="table table-striped" id="groups" --> <table class="display" id="groups"> <thead> <tr> <th><%= model_class.human_attribute_name(:id) %></th> <th><%= model_class.human_attribute_name(:name) %></th> <th><%= model_class.human_attribute_name(:address) %></th> <th><%= model_class.human_attribute_name(:city) %></th> <th><%= model_class.human_attribute_name(:phone) %></th> etc.. i have required javascript jquery data tables in groups.js file

Can I update Nexus Maven "LATEST" metadata without a scheduled task? -

i'm running nexus , have snapshots maven repository. when publish artifacts repository run "rebuild maven metadata files" type task runs 5 minutes , updates "latest" point newest artifacts. can update latest reference other way? publish gradle. can gradle update specific groups metadata? thanks the maven metadata file not managed nexus client side tool. default maven , downloads metadata file part of deployment, updates new snapshot data , uploads again. potentially gradle not correctly , reason have use workaround of using nexus scheduled task. don't think gradle has further tools fix better. thing can think of kick off scheduled task gradle automatically. still have timing problem. best file bug against gradle , fixed.

java - make morphia update document with entity properties instead of replacing it (keep not mapped attributes) -

given example document in mongodb collection: {"_id": 100, "name": "user name", "sidefield": "some value"} and entity morphia: @entity() public class user { @id public long id; public string name; } is possible update mongodb document following example user object user user = new user(); user.id = 100; user.name = "new name"; so morphia not delete "sidefield" attribute? by default when use morphia's datastore.save(...) method, morphia replaces whole document under given _id new one, built entity, deleting way attributes not mapped entity. know can make "manual" updates of selected fields, that's not why added object mapper project's dependencies. finally, have dropped morphia , solved problem using mongodb java driver api 3.0.0 , jackson this: string updatejson = .... //i json string via rest api // here, if want validate update use json schema // or jackson (to

javascript - Variable in RegEx - Turns RegEx Syntax to String - How to avoid? -

in following snippet (example) can see tried build function more comfortable string-replacements in project. really found out it's necessary connect regex-syntax variable, , found regex-objekt solution in topic . but after hours of try(outs), realized solution didn't worked, because converts slashes string, , @ end have simple string again. the following example focused url replace. example, because have slashes in out pattern , input: function replacethis(valinput, valpattern, valreplace) { var regex = new regexp('/' + valpattern + '/', "g"); return valinput.replace(regex, valreplace); } example_input = 'http://localhost/images/important.jpg'; example_target = '/applications/ampps/www/'; example_pattern = 'http:\/\/localhost\/'; // function $('#a').html('[result 1] ' + replacethis(example_input, example_pattern, example_target)); // strings (without function) $('#b').h

javascript - Does angular compute conditionals incorrectly? -

according laws of conditional probability, statement s1 && s2 will never true if s1 false. however, in angular, not alaways true. in html have angular expression: ng-if="file.nodes" file object has node property, , if does, array. angular expression "file.nodes" evaluates false if array exists empty (this problematic js evaluates empty arrays true if statements). however: ng-if="file.nodes && (file.nodes.length == 0 || true)" will evaluated true if array empty. in situation, angular seems not inconsistent js, (or laws of conditional probability). correct in believing bug? since seems egregious if is. some things know 1) in js empty array evaluates "true" 2) || evaluate true if either side of evaluates true 3) && requires both left , right side evaluate true evaluate true file.nodes = [] file.nodes && (file.nodes.length == 0 || true) // true because in js empty array evaluates true (l

git - Not Possible to switch branch after --skip-worktree -

what want do i have file contains sensitive datas don't want push content of file remote server. what did? to achieve this, made commit when file empty , pushed empty file server (github). , fill file sensitive datas , applied git update-index --skip-worktree path/to/file . didn't made commit. now i'm trying switch branch i'm getting error : error: local changes following files overwritten checkout: path/to/file please, commit changes or stash them before can switch branches. aborting why use skip-worktree instead of assume-unchanged ? i read few questions subject, , found borealid's answer . --assume-unchanged assumes developer shouldn’t change file. flag meant improving performance not-changing folders sdks. --skip-worktree useful when instruct git not touch specific file ever because developers should change it. example, if main repository upstream hosts production-ready configuration files , don’t want accidentally

regex - Matching elements within list in R -

imagine have list, defined below: test <- list(1:4,5,8,1,2:3,10) i somehow match elements of list if contain similar numbers. example match test[[1]] , test[[4]] because both contain 1. likewise, test[[1]] , test[[5]] match because both contain 2 , 3. after matching, construct unique id corresponds each match. example answer following list ans <- list(1,2,3,1,1,4) edit: the intuition behind answer if elements of list test share common match, receive same id. means though test[[4]] , test[[5]] don't match, fact each match test[[1]] means assigned same id. this toy example. in practice apply matching large list (>100,000k elements). in mind algorithm need efficient. thanks in advance! here's 1 way using data.table : require(data.table) # generate data.table data id = rep(seq_along(test), sapply(test, length)) dt = data.table(id, val = unlist(test)) # solution dt[, ans := id[1l], by=val][, ans := .grp, by=ans][, ans[1l], by=id]$

windows - How to simulate drop-down form in Delphi? -

Image
how can create "drop-down" window using delphi? everything beyond point research effort; , in no way related answer. research effort making proper drop-down requires lot of pieces work together. assume people don't difficult question, , rather asked 7 separate questions; each 1 addressing 1 tiny piece of problem. follows research effort solving deceptively simple problem. note defining characteristics of drop-down window: 1. drop-down extends outside it's "owner" window 2. "owner" window keeps focus; drop-down never steals focus 3. drop-down window has drop-shadow this delphi variation of same question asked in winforms: how simulate drop-down window in winforms? the answer in winforms use toolstripdropdown class . helper class turns form drop-down. lets in delphi i start creating gaudy dropdown form, serves example: next drop button, thing click make drop-down appear: and wire-up initial code show f

javascript - io.sockets is defined, but socket isn't -

io.sockets.emit works fine , sends message out connected sockets, socket.emit doesn't work , socket undefined. any ideas? var app = require('express')(); var http = require('http').server(app); var io = require('socket.io')(http); var net = require('net'); var express = require('express'); var sqlite3 = require('sqlite3').verbose(); var db = new sqlite3.database('test-db.db'); var tools = require('./public/js/tools.js'); var app_tools = require('./public/js/app.js'); db.serialize(function() { db.run("create table if not exists names (info text)"); }); app.use(express.static(__dirname + '/public')); app.get('/', function(req, res){ res.sendfile(__dirname + '/index.html'); }); io.on('connection', function(socket){ socket.on('chat message', function(msg){ console.log('message geomon-ui:

python - How to connect Django to MongoDB database? -

i want start new project students. , planned use python( django framework ) backend , mysql database. nowadays researched nosql databases , found mongodb. searched django support mongodb seems not supported officially. so, how can use mongodb django ? django 1.5 supports mongodb installing , configuring please follow following link https://django-mongodb-engine.readthedocs.org/en/latest/topics/setup.html . it provides customised django 1.5 helps in working mongodb

How to make android web app? -

i'm new android apps , want tutorial android web app have heared aboud webview think include page url , don't want have own app design , display specific data , make filteration , make search , may user whould login too. view website thank you it depends of kind of web. example blog (wordpress, blogger), social network (facebook, twitter, etc), can use json objects interactuate web. i had simple app retrieve data wordpress blog, can take learn managing json objects , http requests. this link: material app, wordpress blog

Perl's hash of hash of hash redeclaration? -

lets suppose have hash of hash of hash (%hash) values warn dumper \%hash; 'key1'=> {'subkey1'} => {'subsubkey11'} => {'value1'} 'key2'=> {'subkey2'} => {'subsubkey22'} => {'value2'} ... then, want verify if combination of keys absent (assume there above if loop on series of combinations $val1 , $val2 ). if (!exists $hash{$val1}{$val2} ) { #### verifying existent of key , subkey, not subsubkey print "doesn't exists"; } if use after loop finish, going see this: warn dumper\%hash; 'key1' => {'subkey1'} => {} 'key2' => {'subkey2'} => {} 'key1' , 'subkey1' somehow been "assigned" void values and, because may loop several times on same combination of un-existent keys, after first loop on pair of keys second if takes combination existent. what causes , best way solve it. tried de

spring mvc - Connecting to Database From EC2 to Another Database -

i new aws. have created spring web app , database(mysql) in ec2 instance (which working fine). in web application, connecting database in server read , write other database. so, database not mysql database. network admin has opened port 3306 ec2 instance access database ec2. so, problem in end. i have opened 3306 port (my sql) in security group. when telnet port, connection fails. can see in ec2 127.0.0.1:3306 listening 80. so question is, missing here? what options trouble shoot issue? do have authorize tomcat user or bitnami user access ports connect outer database? anything relevant issue helpful thanks in advance :) if listening on 127.0.0.1:3306 listening locally , not accessible form outside. if change 0.0.0.0:3306 make sure security groups configured allow access database own instances. dont "open 3306", open 3306 same security group or security group application spring server in. you not mysql db, yet uses mysql default port 3306. thats b

Added Liquid Fire to Ember CLI project, {{liquid-outlet}} does nothing -

i added liquid fire ember cli 0.2.3 project following steps outline in tutorial: http://www.programwitherik.com/doing-animations-and-transitions-with-liquid-fire-and-ember/ i added liquid fire npm install --save-dev liquid-fire. added transitions.js file code outlined in tutorial. replaced {{outlet}} {{liquid-outlet}}. and...nothing. nothing happening. no errors in logs or console, , nothing displayed outlet is. i've tried tutorial says. missing step make {{liquid-outlet}} work? i had same issue. problem wasn't using correct route names. i enabled env.app.log_transitions = true; option in /config/environment.js . prints route names in console when transitioning, helped me write correct transitions in /app/transitions.js . make sure add {{liquid-outlet}} of outlets when nesting routes. heres transitions.js file: export default function(){ this.transition( this.fromroute('dashboard'), this.toroute('bots'), this.u