Posts

Showing posts from September, 2011

performance - Confusing dottrace profiling results -

ok, here goes. due performance issues on 1 of our production servers, asked use dottrace profiler see going on. project profiling application lot of wcf services running in iis. it's rather complex project , consists of multiple assemblies. through out project ninject used di container. i tried profiling application couple of times on development server make sure working expected, seemed case. i started profiling our production server (using tracing detail level, on w3wp) , instantly performance of server went down , became slow , unresponsive. aware profiler have performance issue, had no idea kill server (on dev server there no problem). so after scary experience in confused. dit dottrace allmost kill our production server? why? the results profiling @ least confusing, , have no idea make of them, me seems ninject issue here, or dottrace profiler playing me? any input highly appriciated! below results dottrace http://i.stack.imgur.com/vvvlm.png update: ok, ex...

xml - Remove empty <ul> nodes from IXMLDOMDOCUMENT in Delphi -

i have many xml nodes in xmldocument. want remove empty <ul> nodes. how can accomplish this? here snippet: <li> <a href="javascript:void(0);">level 1</a> <ul id="subject19"> <li> <a href="javascript:void(0);">level 2</a> <ul id="subject20"> <li> <a href="javascript:void(0);">level 3</a> <ul id="subject21"/> </li> </ul> </li> </ul> </li> i need remove <ul id="subject21"/> you can use simple recursion. here example how: procedure scanandremove(anode: ixmlnode); var i: integer; childnode: ixmlnode; begin := 0; while < anode.childnodes.count begin childnode := anode.childnodes[i]; if (childnode.nodename = 'ul') , (childnode.childnodes.count = 0) anode.childno...

android - Should I put the Ionic Platforms folder into source control? -

i building mobile app using ionic framework, , had added ios , android platforms. need regularly update ios xcode project think should put platforms folder git source control. after added them, found many issues occur git, path long, etc. but if don't add platforms folder git source control, there risks if re-add platform need update information again inside xcode. how guys manage final solution: not put platform folder git source control because make source big , cause errors such path long . configure config.xml file under ionic app root folder xcode project updated automatically. example: specially notice id , version , name , description , etc., configuration values. these configured, don't need update xcode project manually more. <?xml version="1.0" encoding="utf-8" standalone="yes"?> <widget id="com.diankeda.huaquanquan" version="0.0.1" xmlns="http://www.w3.org/ns/widgets...

ios - Webview events not fired -

i using ds.slidemenu widget, has following view: <alloy> <view id="containerview"> <view id="leftmenu"> <tableview id="lefttableview" /> </view> <view id="movableview"> <view id="shadowview"> <view id="navview"> <button id="leftbutton" /> </view> <view id="contentview" /> </view> </view> </view> </alloy> and view display webview following one: <alloy> <view class="container"> <webview id="webview" url="myremoteurlhere" onload="construct"/> </view> </alloy> to introduce code of ds.slidemenu does, here's happens when change view: function rowselect(e) { if (alloy.globals.currentview.id != e.row.customview) { $.ds.contentview.remove(all...

mysql - Migration doesn't execute when I push my Laravel app on Pagodabox.io? -

when push laravel app on pagodabox , seams cancel migrations, keeps saying "command cancelled! success" , when try see live app, getting error message: sqlstate[42s02]: base table or view not found: 1146 table 'gopagoda.posts' doesn't exist (sql: select * `posts`). i did set db credentials production (for mysql db). an app works fine on local server. also, may relevant, have free account. not sure if migrations available free accounts!? <= :::::::::::::::::::::: end build output ::::::::::::::::::::::::::: """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +> uploading libs s...

iis - Start-WebAppPool for Powershell 2.0 -

i'm experiencing problem: need command use on 2 different shells gives me chance restart web pool appliction, 1 of these shells 4.0 (and has command start-webapppool) , other 1 has ps 4.0... i'm supposed do? in advance help. i found solution works surely powershell 2.0 , above. called inside of script that: $args = @() $args += "stop" $args += "apppool" $args += "/apppool.name:poolnamehere" $cmd = "c:\windows\system32\inetsrv\appcmd.exe" invoke-expression "$cmd $args" #poolnamehere stopped. dually, restarting: $args = @() $args += "start" $args += "apppool" $args += "/apppool.name:poolnamehere" $cmd = "c:\windows\system32\inetsrv\appcmd.exe" invoke-expression "$cmd $args" #poolnamehere started. hope helps somebody!

Occasional PostgreSQL "Duplicate key value violates unique constraint" error from Go insert -

i have table unique constraint create unique index "bd_hash_index" on "public"."bodies" using btree ("hash"); i have go program takes "body" values on channel, filters out duplicates hashing, , inserts non-duplicates database. this: import ( "crypto/md5" "database/sql" "encoding/hex" "log" "strings" "time" ) type process struct { db *sql.db bodieshash map[string]bool channel chan bodyiterface logger *log.logger } func (pr *process) run() { bodyinsert, err := pr.db.prepare("insert bodies (hash, type, source, body, created_timestamp) values ($1, $2, $3, $4, $5)") if err != nil { pr.logger.println(err) return } defer bodyinsert.close() hash := md5.new() p := range pr.channel { nowunix := time.now().unix() bodyst...

Case Sensitive matter in Java -

i have menu, "delete" option. delete list town user introduced earlier. , asking you, there code ignore if user introduce upper case or lower case? for example, if list has 3 items: new york, bucharest, paris. if user try delete 1 of item list, if writes "new york", list of items stay same, because didn't use upper cases , program doesn't recognize item. you use equalsignorecase() compare input menu item, method compare strings ignoring case sensitiveness. if (input.equalsignorecase(menuitem)) { //do logic } if menu item="new york" , input="new york", if condition true.

php - Error getting array value by key -

this strange one. i'm making request following code. $opts = array( 'http'=>array( 'method'=>"get", 'header'=>"accept-language: en\r\n" . "bearer: 5ae3lc//bq+k+m2m+tugxw4k4k8=:i3khkxstnxs9fnag/igwpnhyfbo=\r\n" . "cookie: foo=bar\r\n" ) ); $context = stream_context_create($opts); $file = fopen($csvfile, 'r', false, $context); in script receiving request have this: $headers = getallheaders(); var_dump($headers['bearer']); // undefined index: bearer $headers = json_decode(json_encode($headers), true); var_dump($headers['bearer']); //this 1 works. but var_dump of $headers array looks same before or after encode , decode. //first var_dump array(4) { ["host"]=> string(19) "" //removed ["accept-language"]=> string(2) "en" ["bearer"]=> string...

java - Google Calendar event gets created with yesterday's date -

i creating google calendar event today start date showing yesterday date in calendar. e.g when set 21 may 2015 start date in google calendar shows 20 may 2015. in code set default timezone start date of event. date end1 = new date(date in yyyy-mm-dd format + 1 * 24 * 60 * 60 * 1000); com.google.api.client.util.datetime endtime = new com.google.api.client.util.datetime(end1); com.google.api.client.util.datetime starttime = new com.google.api.client.util.datetime(date in yyyy-mm-dd format); insertedentry = updatecalanderevent(event,request,emailslist,title,description,starttime,endtime ,calander.getcalanderid()); event in updatecalanderevent() myevent.setstart(new eventdatetime().setdatetime(startdatetime)); myevent.setend(new eventdatetime().setdatetime(enddatetime)); insertedentry = myservice.events().insert("primary", myevent).setsendnotifications(true).setcalendarid(id.trim()).execute();

android - ReplaceAll the ImageView in FrameLayout -

there framelayout , button,i want add 6 imageview onto framelayout,and replaceall 6 imageview other 6 imageview when click button.thus framelayout may display 12 imageview together.(i use universal_imageloader load image imageview).how resolve problem? you can set images programmatically (not in xml),you dont need have 12 image views. for example set on click listener button,so when click it, set new image imageview: image1 = (imageview) findviewbyid(r.id.imageview1); image2 = (imageview) findviewbyid(r.id.imageview2); image3 = (imageview) findviewbyid(r.id.imageview3); image4 = (imageview) findviewbyid(r.id.imageview4); image5 = (imageview) findviewbyid(r.id.imageview5); image6 = (imageview) findviewbyid(r.id.imageview6); final button button = (button) findviewbyid(r.id.button_id); button.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { image1.setimageresource(r.drawable.mypic1); imag...

android - onItemClickListener only opens first item's span menu -

im trying spannable listview. when click on item in listview should span , reveal 2 buttons. far have managed create customadapter that. my problem when click on item first item on listview spanned. how fix , how set onclicklistener 2 buttons. my listview activity: protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); listview productlist=(listview)findviewbyid(android.r.id.list); productlist.setonitemclicklistener(new adapterview.onitemclicklistener() { @override public void onitemclick(adapterview<?> parent, view view, int position, long id) { product product= (product) parent.getitematposition(position); button checkbutton= (button)findviewbyid(r.id.checkbutton); button deletebutton=(button)findviewbyid(r.id.deletebutton); checkbutton.setvisibility(view.visible); ...

regex - grep ignore characters in the pattern -

the pattern comes variable of length 14. string pattern grep. text file has lines contain 13 characters each. for example, pattern of length 14 is pattern = 58244804671021 and text file contains 3823480467102 4724470467102 how can make grep ignore last char in pattern? suppose pattern in $pattern , using bash, can do grep ${pattern%?} file to remove last character variable. you can use cut character 1 13: grep $(echo "$pattern" | cut -c 1-13 -) file or better in bash , ksh here-string grep $(cut -c 1-13 <<<$pattern) file

multithreading - Thread-safe last_insert_row_id for ruby SQLite library -

i wondering thread-safe way last_insert_row_id be. code looks like: require 'sinatra' require 'sqlite3' db = sqlite3::database.connect("dbname.db") '/' db.execute("insert logs (ip,time) values (?,now())",[request.ip]) return "your row id #{db.last_insert_row_id}" end it's little silly of example, point if 2 people visit @ same time, race condition such 2 people given same row id. how avoid this? baisicly i'm looking ruby-equivelent answer question: how retrieve inserted id after inserting row in sqlite using python? looked , couldn't find in sqlite gem docs cursor, , googling brought me resultset class not have method of retrieving last insert id. the "last insert rowid" property of connection, if need track row ids in multithreaded application, think need separate sqlite connection each thread. an alternative next id manually selecting value sqlite_sequence table (note works if ...

.NET console application embedded Database -

i working console application pointing database installed in local sql server. now have send console application tester testing , doesn't have sqlcserver installed in machine. is there way can use embedded database within console application , it's part of exe tester not dependent upon installing database in machine.

web services - How to pass values to a PHP function via URL? -

i have various functions written inside class in php file, want pass value function browser check whether gets inserted in db. sample code: <? class chat { var $db; . . function chat() { $this->initialize(); } function insertmessage($text) { $text = (string) $_get["message"]; . //insert query . } } ?> i tried http://localhost/www/chat/chat.php/chat.insertmessage?text=%27message%27&[] didn't response. replace $text = (string) $_get["message"]; with $text = (string) $_get["text"];

html - How do I make link the highlight link conform to CSS shape -

Image
how make link outline (blue) conform css shape? mean outline should in same shape link border. would mind linking, or helping me find right words describe it, can research it, or maybe basic fixes? you can use box-shadow (hover see ) button { width: 200px; height: 100px; background: cornflowerblue; border-radius: 5px 25px 5px 25px; border-bottom: 2px solid black; border-top: 2px solid black; border-left:0; border-right:0; outline: 0; } button:hover { box-shadow: 0 0 0 5px orange; } <button></button>

meteor - Changing default 'Sorry, you don't have the rights to view this page' for private Telescope -

i have set telescope app (fresh install) , have set private. need change default template rendered (on homepage) when telescope set private , user not logged in. i have looked through routes , client/views templates , js files , can not figure out how change template gets rendered when telescope installation set private. if want change custom template, don't want mess actual code. you can change template content here , put whatever code like. just sure update en.i18n.json file line 131

asp.net - The name 'ViewBag' does not exist in the current context mvc 5 -

i have web.config inside views folder <?xml version="1.0"?> <configuration> <configsections> <sectiongroup name="system.web.webpages.razor" type="system.web.webpages.razor.configuration.razorwebsectiongroup, system.web.webpages.razor, version=3.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35"> <section name="host" type="system.web.webpages.razor.configuration.hostsection, system.web.webpages.razor, version=3.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" requirepermission="false" /> <section name="pages" type="system.web.webpages.razor.configuration.razorpagessection, system.web.webpages.razor, version=3.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" requirepermission="false" /> </sectiongroup> </configsections> <system.web.webpages.razor> <host factorytype="system.web.mv...

windows - Create Directory using Batch Script with Timestamp -

@echo off /f "tokens=2-4 delims=/ " %%a in ('date /t') (set mydate=%%c-%%a-%%b) /f "tokens=1-2 delims=/:" %%a in ('time /t') (set mytime=%%a-%%b) set mydir="%mydate%-%mytime%" mkdir %mydir% with above batch script, can create directory name 2015-05-14-11-30 am now need convert time 24 format , remove am/pm expected folder name - 2015-05-14-11-30 how ? i think should use %time% pseudo-variable. this example: @echo off /f "tokens=1-4 delims=/:." %%a in ("%time%") ( set hh24=%%a set mi=%%b set ss=%%c set ff=%%d ) /f "tokens=1-2 delims=/,." %%a in ("%ss%") ( set just_ss=%%a ) echo hh24=%hh24% echo mi=%mi% echo ss=%ss% echo ff=%ff% echo just_ss=%just_ss% echo mytime=%hh24%-%mi%-%just_ss% well, realized hh24 has empty space if hour less 10, here have solution, using %time : set hh=%time:~0,2% if "%hh:~0,1%" == " " set hh=0%hh:~1,1%...

jquery - How can I make a form label keyboard accessible? -

i have html5 form collects information , processes when user submits form. uses jquery validation plugin validate inputs and, if there errors, shows error-message-container div @ top of screen containing list of errors, , gives focus screen reader reads them out. implemented using <label for="input id error"> when user clicks on label mouse input error gets focus. this: <form id="ts-qqw-form" action="#" method="post"> <div tabindex="-1" class="error-message-container ts-hidden" id="error-message-container"> <p>the following errors have occurred:</p> <ul> <li><label for="travellerage_1">please provide age of travellers.</label></li> </ul> <!-- ... --> </div> <div class="ts-qqw-section clearfix"> <h4>who</h4> <div class=...

jquery - I want to change a profile picture when i select a image -

$('#profile_picture').on("change",function(){ var files = !!this.files ? this.files : []; what above code !!this.files ? this.files : [] mean? if (!files.length || !window.filereader) return; if (/^image/.test( files[0].type)){ var reader = new filereader(); reader.readasdataurl(files[0]); reader.onloadend = function(){ $("#imgchange").attr("src", "+this.result+"); } } }); that used check whether new fileapi supported. if new file api not supported file input's files property undefined !this.files false , when add 1 more ! false again negated true $('#profile_picture').on("change", function () { // files new property new file api, if if not supported assign empty array value of files var files = !! this.files ? this.files : []; //if there no files , filereader not supported return if (!files.length || !window.f...

d3.js - Append css to svg in D3 -

am newbie d3.i trying add bubble feature circle drwan in d3.i have added css achive bubble effect. have inspect element css added circle bubble effet not reflecting. in advance <style type="text/css"> .ball { display: inline-block; width: 100%; height: 100%; margin: 0; border-radius: 50%; position: relative; background: radial-gradient(circle @ 50% 120%, #81e8f6, #76deef 10%, #055194 80%, #062745 100%); } .ball:before { content: ""; position: absolute; top: 1%; left: 5%; width: 90%; height: 90%; border-radius: 50%; background: radial-gradient(circle @ 50% 0px, #ffffff, rgba(255, 255, 255, 0) 58%); -webkit-filter: blur(5px); z-index: -1; } .ball .shadow { position: absolute; width: 100%; height: 100%; background: radial-gradient(circle @ 50% 50%, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.1) 40%, rgba(0, 0, 0, 0) 50%); -webkit-transform: rotatex(90deg) translatez(-150px); -moz-transform: rotatex(90deg) translatez(-150px); -m...

java - Kryo deserializer throws ClassNotFoundException in spark: Unable to find class -

i writing spark job in scala run spark 1.3.0. rdd transformation functions use classes third party library not serializable. make closure serialization possible, wrap these objects in com.twitter.chill.meatlocker java.io.serializable uses kryo wrapped objects. make uber jar using assembly. when run job, executors tasks fail throwing classnotfoundexception same classes wrapped inside meatlocker. know there related bug in spark 1.2.x googling on subject suggests me has been fixed in 1.3.0. https://issues.apache.org/jira/browse/spark-6069 i have tried spark configuration property spark.executor.userclasspathfirst=true no effect. passed property spark-submit script so: spark-submit --class <my-class> <my-jar> --conf spark.executor.userclasspathfirst=true beyond stuck no option source of third party library , include in project after making these classes implement java.io.serializable. way eliminate need kryo serialization altogether thereby not running issue hope bett...

Amazon cloudsearch -

i using following pattern search, using aws cloudsearch. "size=#{size}&start=#{start}&rank=-time&bq=(phrase+field%3dtitle+#{title})" but, got following error in log file. {"error"=>"info", "rid"=>"e2467862eecf73ecde7f57355cd6db92c97fad04398ce82b1f57903fa3c9b6fe81d4b1abf5036425", "time-ms"=>0, "cpu-time-ms"=>4, "messages"=>[{"severity"=>"fatal", "code"=>"cs-invalidmatchsetexpression", "message"=>"[warning] syntax error in match set expression: unexpected '=' character"}] give me suggestion. in advance.

Converting JSON array result from responseText to structured headings and paragraphs -

using xmlhttprequest , json open array: var xmlhttp=new xmlhttprequest(); xmlhttp.open("get","http://serv.json",false); xmlhttp.send(); result=xmlhttp.responsetext; document.getelementbyid("sec1").innerhtml=xmlhttp.responsetext; results come through this: [ { "name": "", "description": "" }, { "name": "" , "description": "" }] need structure results headings names , paragraphs description. tried several loops none seem working. correct loop use? incorrect loop: (not sure place createelement , appendchild for (i=o; i> fruit.length;i++){ document.getelementbyid("sec1").innerhtml=fruit[0].name + "" + fruit[0].description:; } try along lines of following: <html> <body> <div id="sections"> </div> <script> var request = new requestrequest(); request.open("get",...

javascript - jQuery datepicker working in front end but not wordpress admin dash -

i have current code enqueuing jquery date picker: function register_my_scripts() { wp_register_script('scripts', plugins_url('/js/scripts.js', __file__)); wp_enqueue_script('scripts'); wp_enqueue_script('jquery-ui-datepicker'); } function register_my_styles() { wp_enqueue_style('e2b-admin-ui-css','http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/themes/base/jquery-ui.css',false,"1.9.0",false); } add_action('wp_enqueue_scripts', 'register_my_scripts'); add_action('wp_enqueue_scripts', 'register_my_styles'); the jquery function inside scripts.js: jquery(document).ready(function(){ jquery('.datepicker').datepicker({ dateformat : 'd, m/d/yy' }); }); and html field: <input type="text" class="datepicker"/> this code work fine on front end reason doesn't on end. need work on backend. what's going on ...

mysql - How can I echo a BLOB using JSON array in php? -

i have seen many examples cannot echo looking for. goal convert blob base64 , echo json array using php. aware storing images in database blob not proper approach want sake of knowing how (general consensus seems storing references images in turn stored in file system better approach). aware there multiple security issues in php code (very new php). know this. here structure of table: http://s27.postimg.org/lod0ec0er/screen_shot_2015_05_13_at_10_49_29_pm.png here contents of table: http://s15.postimg.org/joks2fvzv/screen_shot_2015_05_13_at_10_51_34_pm.png here first php code attempt (before realizing had convert blob base64): if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } $sql = "select * testimages"; if($result = mysqli_query($con, $sql)) { $resultarray = array(); $temparray = array(); while($row = $result->fetch_object()) { ...

objective c - How to make a boolean both static and __block? in iOS? -

bool _hintexist; - (void)shownotreachable { if (_hintexist) { return; } nslog(@"show hint"); dispatch_after(dispatch_time(dispatch_time_now, (int64_t)(3 * nsec_per_sec)), dispatch_get_main_queue(), ^{ _hintexist = no; }); } the code above fine. there button trigger method. actually, don't need _hintexist global variable. want make bool _hintexist in method.however, when tried add both static , __block in front of bool _hintexist. there compile error. amazed change _hintexist in block if made global variable. explain why? , what's difference if add static before bool _notreachablehintexist, global variable in code? __block scope modifier local variable allows block modify value of local variable declared in outer scope. your _hintexist variable isn't local variable. it's global. there no need __block modifier. block has access global variable other piece of code in same file. if add static _hintexist ...

java - Storing hashmap values as program iterates -

i trying solve programming challenge outlined below, wherein need find word in given sentence greatest number of repeated characters. have struggled bit this, , lucky enough find code counting occurrences of letters in string (also below). particular piece of code store letters in hashmap, , need tailor stores character occurrence of each word separately (instead of in aggregate, doing @ moment). stuck. use store state of hashmap each iteration of loop? /* using java language, have function lettercounti(str) take * str parameter being passed , return first word * greatest number of repeated letters. example: "today, * greatest day ever!" should return greatest because has 2 e's * (and 2 t's) , comes before ever has 2 e's. if there * no words repeating letters return -1. words * separated spaces. */ import java.util.arraylist; import java.util.hashmap; import java.util.map; public class othercountletters { void countletters2(string str) { ...

javascript - Restrict google maps API marker to only one click per marker -

i'm creating simple map phonegap app click map, , marker added, , popup form shows. working fine, need make sure each marker clickable once. this i've tried far: google.maps.event.addlistener(clickmarker, 'click', function (e) { addlocations(this.getposition()); // calls popup form /* clickmarker.setoptions({ clickable: false });*/ clickmarker.setclickable(false); }); is i'm asking possible? if possible, doing wrong? no, instead of set clickable false, try removing event listener clickmarker.addlistener('click', //add listener marker object directly function (e) { addlocations(this.getposition()); // calls popup form // ever things want before calling // removing event, can call once google.maps.event.clearlisteners(clickmarker, "click"); // don't forget 's' }); since you're working phon...

Python: insert into arrays based on condition -

the code below producing error: traceback (most recent call last): file "pulllist2.py", line 28, in <module> list_sym[w] = symbol indexerror: list assignment index out of range what trying achieve here add element array if word1 , word2 in string of security_name . not know way initialize arrays either. #!/usr/bin/env python3 import glob import os import sys import fnmatch list_sym = [] list_name = [] w = 0 count = 0 word1 = 'stock' word2 = 'etf' # loop parses lines appropriate variables file in glob.glob('./stocklist/*.txt'): open(file) input: line in input: # split line variables.. trash have no use symbol, security_name, trash = line.split('|', 2) if word1 in security_name or word2 in security_name: # stores values in array list_sym.append(1) ## initialize arrays list_name.append(1) list_sym[w] = symbol list_name[w] = securit...

soap - How can I provide a limited output of a PHP-Loop from a SoapClient call to 19 items? -

i make soap call , return tree-object data want process. use foreach() loop , display on page. of calls got many items , need add limit iteration x ammount of items on front end. foreach($variable->node->node $object) { ?> <div class="page"><p><? echo $object->node; ?></p></div> with limit wonder how can can counter 19 items before adding break , close tab. end ups like: <div class="page"><p>item 1</p><p>item 2</p>.... item 20</p></div> <div class="page"><p>item 20</p><p>item 21</p>.... you can make counter in 2 ways, first regular counter like: $counter++; that code increments var $counter one. or can use statement counter: foreach($variable->node->node $counter=>$object) { with done, can create point of break this: if(!($counter % 19)) add_break_and_close_tab()

php - Where with Eloquent Model -

in laravel, have 2 table: post table: ╔════╦══════════════╦══════╗ ║ id ║ content ║userid║ ╠════╬══════════════╬══════╣ ║ 1 ║ lorem 1 ║ 1 ║ ║ 2 ║ lorem 2 ║ 3 ║ ║ 3 ║ lorem 3 ║ 1 ║ ║ 4 ║ lorem 4 ║ 2 ║ ╚════╩══════════════╩══════╝ and user table: ╔════╦════════════════╗ ║ id ║ email ║ ╠════╬════════════════║ ║ 1 ║user1@email.com ║ ║ 2 ║user2@email.com ║ ║ 3 ║user3@email.com ║ ║ 4 ║user4@email.com ║ ╚════╩════════════════╝ i want select posts posted user id using laravel. post, user model: #post model class post extends \eloquent { public function user() { return $this->belongsto('user', 'userid'); } } #user model class user extends \eloquent { public function post() { return $this->hasmany('post'); } } now, select using laravel eloquent: $post = post::with(array( 'user' => function($query) { $query->where('ema...

linux - Regex syntax error with Sed command in Ubuntu 9.04 -

i have sed command this: radius_clientsfile=clients.conf iface_netsize="/64" wireless_prefix=fd04:bd3:80e8:3:: sed -i "/client $wireless_prefix\\$iface_netsize/ {n s/\(\w*secret\w*=\w\).*/\1$key/}" $radius_clientsfile clients.conf has content this: client fd04:bd3:80e8:3::/64 { secret = 00000000000000000000000000000001 } which aim replace value of secret key in clients.conf file. example, if key 00000000000000000000000000000002, content of clients.conf should changed following: client fd04:bd3:80e8:3::/64 { secret = 00000000000000000000000000000002 } this script work on openwrt attitude adjustment r35400 armv5tejl however, can not work in ubuntu 9.04 error: sed: -e expression #1, char 36: characters after command could me situation? i think need add ; between command n , command s , this sed -i "/client $wireless_prefix\\$iface_netsize/ {n; s/\(\w*secret\w*=\w\).*/\1$key/}" $radius_clientsfile this wo...

Visual Studio shows only attach and no run with PTVS RC -

i downloaded ptvs rc today , installed it. after restarting vs, there error importing python tools said following , solutions not being loaded: no exports found match constraint based on post here @ so, renamed componentmodelcache file. although vs loads old solutions, see attach button , no run/debug button. new projects, works fine. using visual studio 2013 professional edition. help? it seems issue not ptvs rc. although had 1 project in solution, had set startup project. can done right-clicking on solution. once startup project set, solution run.

how to make dijit vertical toolbar with dojo programatically or declaratively -

using dijit/toolbar renders horizontal toolbars. need vertical. <div id="toolbar1" data-dojo-type="dijit/toolbar" ><div data-dojo-type="dijit/form/button" id="toolbar1.cut" data-dojo-props="iconclass:'dijiteditoricon dijiteditoriconcut', showlabel:false">cut</div ><div data-dojo-type="dijit/form/button" id="toolbar1.copy" data-dojo-props="iconclass:'dijiteditoricon dijiteditoriconcopy', showlabel:false">copy</div ><div data-dojo-type="dijit/form/button" id="toolbar1.paste" data-dojo-props="iconclass:'dijiteditoricon dijiteditoriconpaste', showlabel:false">paste</div ><!-- following adds line between toolbar sections --><span data-dojo-type="dijit/toolbarseparator"></span ><div data-dojo-type="dijit/form/togglebutton" id="toolbar1.bold" ...

c# - Export Excel 97-2003 (xls) with template (VBA macros and format, style) without COM -

i have excel template 97-2003 (xls) contains vba macros, format/formula , style , put on web application (asp.net mvc, c#) , i'm stuck in writing function 'export data filled in excel template without using com, result format must *.xls'. , need update vba macros programmatically tool. i've tried excellibrary https://code.google.com/p/excellibrary/ save cells content. , epplus library don't work xls. going com interface ms excel easiest option write xls (but please notice microsoft is not recommending use office components in server-side apps due technical , licensing considerations.) there couple of 3rd party commercial .net (with .net interface) components capable of reading , writing xls: gembox.spreadsheet aspose.cells infragistics excel spreadsheet gear bytescout spreadsheet sdk disclosure: affiliated bytescout

java - jaxrs - Unable to call the webservice : 404 Not Found Error -

i have created simple webservice unable call it. 404 not found error. package com.fms.mdw.rest; @path("/search") public class searchwebservice { @post @path("/searchdata") @consumes(mediatype.application_json) @produces("application/json") public fmsresponseinfo getsearchdata(searchdto searchdto) { system.out.println("entered getsearchdata()"); fmsresponseinfo fmsresponseinfo = new fmsresponseinfo(); list<searchdetailsdto> searchdetailsdtolist = new arraylist<>(); (int = 0; < 5; i++) { searchdetailsdto searchdetailsdto = new searchdetailsdto(); searchdetailsdto.setbarcode("barcode" + i); searchdetailsdto.setdocno("docno" + i); searchdetailsdto.setdoctype("doctype" + i); searchdetailsdtolist.add(searchdetailsdto); } fmsresponseinfo.setstatus("200"); ...

Video Streamer using m3u8 file in android -

hi i'm trying play video streamer prompt "can't play video" don't know why i'm following [this] http://www.androidbegin.com/tutorial/android-video-streaming-videoview-tutorial/ tutorial. put in android manifest <uses-permission android:name="android.permission.internet" /> but still not working. have error says "unable create media player" can me please? thank help. finally solve problem :) put <uses-permission android:name="android.permission.internet" /> first before application tag in android manifest

scala - Scalamock scalatest - Not able to stub -

i have created workflow processor trait similar 1 mentioned below: import org.scalatestplus.play._ import play.api.mvc._ import play.api.test._ import play.api.test.helpers._ import org.scalatest.matchers._ import org.scalamock.scalatest.mockfactory import utils.oauthutils._ import utils.oauthutils import utils.oauthprocess import play.api.application import scala.concurrent.executioncontext import scala.concurrent.future import play.api.libs.json.jsresult import play.api.libs.json.json import play.api.libs.json.jssuccess import play.api.libs.json.jserror import play.api.libs.ws.ws trait myprocess[a] { type b type c type d def stage1(s: string): b def stage2(b: b)(implicit e: executioncontext, app: application, a: a): future[c] def stage3(c: c)(implicit e: executioncontext, app: application, a: a): future[jsresult[d]] def process(s: string)(implicit e: executioncontext, app: application, a: a): future[jsresult[d]] = { val b = stage1(s) val f_d = { ...

javascript - js each loop add one more depth to an object or array -

Image
i have array of pages urls, need make hierarchy of out it. so this: allpages = [ { "url": "/polygon/color/red.html", "name": "red" }, { "url": "/polygon/color/blue.html", "name": "blue" }, { "url": "/polygon/shape/tri.html", "name": "triangle" }, { "url": "/weight/heavy.html", "name": "heavy item" } ]; to this: sitemap = [ polygon: color: [{url:"red.html", name:"red"}], [{url:"blue.html", name:"blue"}], shape: [{url:"tri.html", name:"triangle"}], weight: [{url:"heavy.html", name:"heavy item"}], ]; the final structure can object or array. can use js, not jquery nor php. edit: changed input data array of objects. sorry making harder...

node.js - HTTP GET request in Swift IOS -

this 1 killing me! long story short, running node.js server communicates mongo database. have been successful submitting data http post(and see results), life of me failing requests. my code: let url = nsurl(string: "http://*******/users/userlist") let requestget = nsmutableurlrequest(url: url!) var response: nsurlresponse? requestget.httpmethod = "get" requestget.addvalue("application/json", forhttpheaderfield: "accept") nsurlconnection.sendasynchronousrequest(requestget, queue: nsoperationqueue.mainqueue()) {(response, data, error) in println(nsstring(data: data, encoding: nsutf8stringencoding)) } i able step through code above, reason when hit "nsurlconnection" xcode ignores 'println', somthing cannot explain. i know i'm doing pretty stupid....

java - Amazon sesThrottling – Maximum sending rate exceeded -

as per documentation says, if reach max send rate, error. max send rate 14 emails per second , tried send 100 mails concurrenlty, emails arrived recipient. so wonder why amazon ses didn't send "signal" complaining excess or easier, why amazon ses did deliver 100 emails when supposed send 14. here code used: list<string> destinations = new arraylist<>(); //replace email addresses (int = 0; < 100; i++) { destinations.add("receiver address"); } int i=0; (string destination : destinations) { new thread("" + i){ public void run(){ system.out.println("thread: " + getname() + " running"); int maxretries = 10; while(maxretries-->0) { try { // create subject , body of message. content subject = new content().withdata("asunto"); ...

javascript - Emberjs - Controller always gets default value from 'needs' controller -

i have situation have application controller 'needs' access property controller, this: app.applicationcontroller = ember.controller.extend({ needs: ['sort'], actions: { appclicked: function () { console.log('controllers.sort.ismenuexpanded'); } } }); app.sortcontroller = ember.controller.extend({ ismenuexpanded: false, actions: { menuclicked: function () { this.toggleproperty('ismenuexpanded'); } } }) as expected, applicationcontroller's appclicked function correctly logs 'false' first time run. however, continues logging false (the default value set in sortcontroller) after ismenuexpanded property has been changed 'true' sortcontroller. this may have way javascript passes values. think objects passed reference, , sure enough, if change ismenuexpanded property to: ismenuexpanded: { expanded: false } and change toggle to: this.toggleprope...

scala - Sort a list given a list of indices -

say have 1 unordered list val unsorted = list("third", "second", "fourth", "first") and have list has indices of above list in proper order val ids = list(3, 1, 0, 2) how can sort unsorted using these indices result list("first", "second", "third", "fourth") simply map ids onto unsorted list itself. scala> val sorted = ids map unsorted.toindexedseq sorted: list[string] = list(first, second, third, fourth) converting unsorted indexedseq not necessary, @gzm0 points out below prevents operation being o(n^2) .

How to unhide/otherwise access files invisible to windows -

i have old application i've moved computer computer on years. running nt or maybe windows 95 when got it. still runs fine, tried of files created using , find hidden. when run app can read them or write them, when try access them either via command line or windows explorer not found. can see them cygwin command line, prefer explorer. my theory because app old putting user data in c:\programfiles(x86)\myapp\data rather in user\appdata directory more recent versions of windows happier with. what i've tried: using attrib remove hidden attributes (failed permission issue) same, running attrib in cmd window admin privileges (no permission error message, files not subsequently show up) copying using cygwin command line (got unhelpful message "omitting directory `data'") any suggestions try next? running windows 7. i happy fix once , fix (setting permissions somehow?); satisfied workaround "run following command every time want files up...

javascript - Tumblr API - can GET but not POST -

i'm trying create page users can log in tumblr account , fill out form post blog. i'm using hello.js tumblr module. i've modified tumblr module demo , seems working in terms of logging in , authenticating. however, i'm unable convince api let me use oauth-restricted post commands. commands, such retrieving user's followed blogs, work fine. if try simple such user/follow follow new blog, "401 not authorized" response. what causing oauth restricted commands working fine, post not? you can see testing code live @ http://www.jereddanielson.com/testing/tumblr/hello.js-master/demos/tumblr.html below pertinent javascript. i'm using oauth proxy @ https://auth-server.herokuapp.com/ function login(network){ hello( network ).login({scope: 'publish_actions, publish, post, post_actions, follow, follow_actions'}).then( function(r){ // followed blogs hello(network).api({path: '/user/following', method: "get"}).the...

ios - Realm Swift 0.92.3 "Run Script Phase" not working -

Image
trying use new realm-swift-0.92.3, can't “run script phase” work. follow instructions here . my run-script entry according the instructions (see image below): unfortunately, still following error message while trying compile (see below). still wrong ??? bash: /users/xxx/library/developer/xcode/deriveddata/myappglnkfueqyjbdhurfurfkip/build/products/debug-iphonesimulator/myapp.app/frameworks/realmswift.framework/strip-frameworks.sh: no such file or directory my framework-search-paths set, follows: /users/xxx/.../myapp/frameworks/realmswift.framework/frameworks i appreciate on ! make sure framework added embedded binaries , embed frameworks. while first step you're supposed do: "go xcode project’s “general” settings. drag realmswift.framework ios/ or osx/ directory “embedded binaries” section. make sure copy items if needed selected , click finish.", reason didn't add there me, project.

html - How to align a div to the right of an iframe? -

in jsp have iframe , div. div has 4 buttons. <iframe id="iframe_role" src="" width="75%" height="75%" scrolling="auto" frameborder="1"> </iframe> <br><br> <div id="div_buttons"> <button type="submit" id="button_add">add role</button> <button type="submit" id="button_edit">edit role</button> <button type="submit" id="button_delete">delete role</button> <button type="submit" id="button_refresh">refresh</button> </div> i want align div right of iframe right side of iframe aligned right side of refresh button. i tried using align attribute of div: <div id="div_buttons" align="right"> but aligned div right of browser window. how can align div right of iframe? you can make div wide ifr...

.htaccess - Forwarding to /index.php in IIS -

my client using iis webhosting service (annoyingly) doesn't recognize index.php default document. i've written simple index.html <meta> refreshes page index.php , there way i'd in .htaccess document in iis? for example, can write web.config document following , drop in root, .htaccess ? rewriteengine on rewritebase / rewritecond %{request_uri} ^$ rewritecond %{http_host} ^domain.com$ rewriterule ^$ http://www.example.com/index.php [l,r=301] i don't have other access ftp. try with <configuration> <system.webserver> <defaultdocument> <files> <add value="index.php" /> </files> </defaultdocument> </system.webserver> </configuration> in web.config

android - How to move Date under X axis? -

i using philjay/mpandroidchart library in app , i'd know if 2 things possible: to show last 14 days , scroll previous days? can dates (currently on top of graph) moved bottom, along x axis? here current pic app , want move date my method: private void populategraph(cursor data) { arraylist<entry> cravingspoints = new arraylist<entry>(); arraylist<entry> severitypoints = new arraylist<entry>(); arraylist<string> dates = new arraylist<string>(); int index = 0; (int = 0; < data.getcount(); i++) { if (i == 0) { // if orientation changed need start first 1 again data.movetofirst(); } else { data.movetonext(); } try { string date = data.getstring(data.getcolumnindex(smokefreecontentprovider.diary_date)); int cravings = data.getint(data.getcolumnindex(smokefreeconten...

c# - Strongly Typed Generic Attribute alternatives -

lets start simple view model: public class myviewmodel { public string value { get; set; } public ienumerable<selectlistitem> values { get; set; } } a drop down list might like: @html.dropdownlistfor(m => m.value, model.values) however, because drop down list requires 2 values can't used like: public class myviewmodel { [uihint("dropdownlist")] public string value { get; set; } public ienumerable<selectlistitem> values { get; set; } } with view containing: @html.editformodel() because there no inherent way drop down know source, until derrive uihint: public dropdownlistattribute : uihintattribute { public dropdownlistattribute (string valuessource) : base("dropdownlist", "mvc") { } } then 1 might use like: public class myviewmodel { [dropdownlist("planets")] public string planetid{ get; set; } public ienumerable<selectlistitem> planets { get; set; } [dropdownlist(...