Posts

Showing posts from August, 2010

Twitter Typeahead with Local Dataset -

i can't understand why tutorial example not work me: i have external js libraries: " https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js " " http://twitter.github.io/typeahead.js/releases/latest/typeahead.bundle.js " and code on load document: <script type="text/javascript"> $(document).ready(function () { $('input.typeahead').typeahead({ name: 'cars', local: ['audi', 'bmw', 'bugatti', 'ferrari', 'ford', 'lamborghini', 'mercedes benz', 'porsche', 'rolls-royce', 'volkswagen'] }); }); </script> i have css: <style type="text/css"> .bs-example { font-family: sans-serif; position: relative; margin: 100px; } .typeahead, .tt-query, .tt-hint { border: 2px solid #cccccc; border-radius: 8px;

mysql - SQL - Query to find if a string contains part of the value in Column -

i trying write query find if string contains part of value in column (not confuse query find if column contains part of string). example have column in table values abc,xyz. if give search string abcdefg want row abc displayed. if search string xyzdsds row value xyz should displayed the answer "use like". see documentation: https://dev.mysql.com/doc/refman/5.0/en/string-comparison-functions.html you can where 'string' concat(column , '%') thus query becomes: select * t1 'abcdefg' concat(column1,'%'); if need match anywhere in string: select * t1 'abcdefg' concat('%',column1,'%'); here can see working in fiddle: http://sqlfiddle.com/#!9/d1596/4

php - Installing Laravel on DigitalOcean error -

i've tried install laravel on vps, got error in "bootstrap/compiled.php": file_put_contents(): 0 of 197 bytes written, possibly out of free disk space i'm using lamp stack, installing via composer create-project . followed these steps: install via composer create-project set permissions , user group: chgrp -r www-data myproject chmod -r 775 myproject/app/storage after these still getting error. trying, services.json created it's became empty , laravel can't write in it. what missing?

How to send error in laravel response? -

i writing code changing password. code follows: public function changepassword(changepasswordrequest $request) { $credentials = ['email'=>auth::user()->email, 'password'=>$request['old_password']]; if (auth::validate($credentials)) { password change code; } else { should there? } } without using ajax can return redirect view errors. should error sending code in else part when using ajax, if old password wrong? can match old password in changepasswordrequest.php well? return response()->json(['old_password'=> ["your old password not correct."] ], 403);

django - Python REST API access custom header values -

i using django rest-framework posting or getting data client application. client application sending custom header along request. how can access custom header value in rest api. custome-header-key: asdqweryhh #this custom header set client. please help thanks you can use request.meta dictionary. with exception of content_length , content_type, given above, http headers in request converted meta keys converting characters uppercase, replacing hyphens underscores , adding http_ prefix name. so, example, header called x-bender mapped meta key http_x_bender. so header value in example do: request.meta['http_custom_header_key']

How to upload short videos (10-15 secs) from an Android App to AWS using Node.js? -

once application gives me get request file along video, should use in our node.js file correctly optimize video, compress/encode video in format , minimize uploading time end user? i understand file needs asynchronously uploaded. should backend systems designed like? we'll using aws , , mongo db . videos uploaded s3 bucket . best practice? basic requirement trying make uploading video scalable , concurrent multiple users upload video. are there kind of best practices or tutorial kind of video formatting , uploading in node.js looking for?

c# - How to check if currently logged in user exists in Active Directory -

we have web application ldap/active directory authentication in place. now requirement if user, exists in active directory, logged in machine , accesses web application, doesn't require authentication. directly authenticated , landed website's landing page. could please guide if have idea/hint/ref/solution? thank much. first need change authentication "windows" , force website users enter windows credential , can validate on page load 1) enable windows authentication in iis , disable anonymous authentication more information see article : windows authenticaition asp.net 2) on page load identify identity of user using page.user.identity 3) query ldap through using system.directoryservices , using system.directoryservices.activedirectory check if user exist or not for more detailed info on ad useful article almost ad

Strong parameter does not work when i new model and controller in spree '3-0-stable' and rails 4.2 -

how add new fields spree::pre_order in spree-3.0 + rails4 ? like old customization: ========================== app/controllers/spree/api/pre_order_controller class preordercontroller < spree::api::basecontroller def create @pre_order = preorder.new(pre_order_params) if @pre_order.save end respond_with(@pre_order) end private def pre_order_params params.require(:pre_order).permit(:user_id,:is_order_created) end end i got following error { "exception": "param missing or value empty: pre_order" } please let me know comments.

java - Spring Integration Aggregator -

i want use aggregator create message out of 2 messages, i'm not sure how this. at moment i'm reading in 2 files directory , want aggregate messages one. my whole project looks this: read in .zip -> pass custom message handler unzips directory -> read files directory -> try aggregate them it great if send message 2 payloads after unzipping file, aggregating after reading suffice. my unzipper looks this: public class ziphandler extends abstractmessagehandler { file dat; file json; @override protected void handlemessageinternal(message<?> message) throws exception { byte[] buffer = new byte[1024]; try { file file = (file) message.getpayload(); zipfile zip = new zipfile(file); (enumeration<? extends zipentry> entries = zip.entries(); entries .hasmoreelements();) { zipentry ze = entries.nextelement(); string name = ze.getname(); if (name.endswith(".dat&qu

javascript - Angular JS, I get how it works, but where should I use it? -

i skimmed angular js documentation, , it's rather interesting have say, maybe because have lack of immagination (perhaps of intelligence), cannot figure out many practical uses that. in situation say: "oh, thank god there's angular js , can task that."?

Edit HTML Comment Text using JQuery or Javascript -

is possible edit text enclosed inside html comment using javascript or jquery. example if have comment like: <!-- comment --> then possible change text 'this comment' using jquery or javascript? thanks. you can iterate through childnodes of comment's parent element, filter commentnode , change it's value resetting nodevalue property: $('#parent').contents().each(function() { if ( this.nodetype === 8 ) { this.nodevalue = 'changed value'; } }); using vanilla javascript : var parentnode = document.getelementbyid('parent'); [].foreach.call(parentnode.childnodes, function(el) { if ( el.nodetype === 8 ) { el.nodevalue = 'changed value'; } });

How to send c++ lists via sockets to a remote server and write those info to a file using PHP -

i want achieve following: send data above c++ source php script (that create) on remote server via sockets (can wether winhttp or regular sockets, no curl or other 3rd party libraries) the php parse data , write file. there can multiple files, files need numbered. #include <windows.h> #include <stdio.h> #include <tchar.h> #include <psapi.h> #include <dirent.h> #include <iostream> #include <string> #pragma comment( lib, "psapi.lib" ) using namespace std; void printprocessnameandid( dword processid ) // list of running processes { tchar szprocessname[max_path] = text("<unknown>"); handle hprocess = openprocess( process_query_information | process_vm_read, false, processid ); if (null != hprocess ) { hmodule hmod; dword cbneeded; if ( enumprocessmodules( hprocess, &hmod, sizeof(hmod), &cbneeded) ) { getmodulebasename(

asp.net mvc - Use different solr requesthandlers for different webpages -

i using solrnet. have 2 handler. 1) /default handler 2) /mysearch handler 1st 1 used few of webpages & 2nd 1 used other webpages. so, how can use both of handlers different webpages? please advise me possible or not?

javascript - Value of button as a 2-word variable -

i've looked up, haven't found two-word variables. i'm trying set button value variable, name, 2 words. i've tried 2 different ways, both end printing first name, , not both. var $div = $("<div></div>"); (var = 0; < people.length; i++) { $div.append( "<p>" + "<input type='submit' value="+people[i].name+" id="+i+">" + "</p>" + "<br>" ); } $("#left2").append($div); and i've tried this: (var = 0; < people.length; i++) { $("#left2").append( "<p>" + "<input type='submit' value="+people[i].name+" id="+i+">" + "</p>" + "<br>" ); } why printing out first name, , not both? edit: everyone! wish accept answ

java - unable to connect spring with mysql -

i working on spring hello samples spring documentation. in connecting embedded database, instead trying configure mysql database. samples git https://github.com/spring-guides/gs-batch-processing.git kindly guide me steps. adding jdbc-driver pom.xml <?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>org.springframework</groupid> <artifactid>gs-batch-processing</artifactid> <version>0.1.0</version> <parent> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-parent</artifactid> <version>1.2.2.release</version> </pare

android - uiautomator feature not consistent with all ROM -

i writing simple ui test app following uiautomator guildline . mentioned sample worked on s5, fail on of occasion. not sure why? another issue: same thing not working on mob sony-z have tested. following error log: com.android.uiautomator.core.uiobjectnotfoundexception: uiselector[description=apps] at com.android.uiautomator.core.uiobject.clickandwaitfornewwindow(uiobject.java:432) @ com.android.uiautomator.core.uiobject.clickandwaitfornewwindow(uiobject.java:410) @ com.org.example.test.launchsettings.testdemo(launchsettings.java:26) @ java.lang.reflect.method.invokenative(native method) @ com.android.uiautomator.testrunner.uiautomatortestrunner.start(uiautomatortestrunner.java:160) @ com.android.uiautomator.testrunner.uiautomatortestrunner.run(uiautomatortestrunner.java:96) @ com.android.commands.uiautomator.runtestcommand.run(runtestcommand.java:91) @ com.android.commands.uiautomator.launcher.main(launcher.java:83) @ com

c# - Composite c1 Odata Pageresult -

i'm having difficulties using odata in combination pageresult. correct result, 5 items if set [queryable(pagesize=5)] but no nextlink, expect, can next results of page 2 example. composite c1 uses it's own xml datastore, , think that's core of problem. all of examples found odata v3 (the version installed if use http://www.composite.net/products/add-ons/all/composite.aspnet.webapi ) tell me use [queryable(pagesize=5)] , should work out of box. use entity framework, don't , think that's breaks. this result, without nextlink: <data> <imageitem> <id>1eeb46e3-1446-45e8-bab2-03ccb637b2ab</id> <title/> <subtitle/> </imageitem> <imageitem> <id>1eeb46e3-1446-45e8-bab2-03ccb637b2ab</id> <title/> <subtitle/> </imageitem> <imageitem> <id>1eeb46e3-1446-45e8-bab2-03ccb637b2ab</id> <tit

smarty - Include path from root -

i have structure kinda this: src ---stuff1 ------stuff2 ---------stuff3 ------------tpl1.tpl ---dir1 ------dir2 ---------dir3 ------------tpl2.tpl i want include tpl2.tpl in tpl1.tpl , how can avoid monsters this: {include file="../../../../../dir1/dir2/dir3/tpl.tpl"} ? php file: <?php $root = "/path/to/the/root/of/my/site/or/templates" $smarty->assign('root',$root); template file: {include file="`$root`/dir1/dir2/myfile.tpl"} or {include file="$root/dir1/dir2/myfile.tpl"} or {include file="$root|cat:"/dir1/dir2/myfile.tpl"} http://www.smarty.net/docs/en/language.syntax.quotes.tpl

android - if condition of string and editText -

i'm newbie in android programming. , i'm being confused of error in line saying, "incompatible operand types edittext , string" the usertype variable spinner while user variable edittext if((usertype.getselecteditem()=="administrator")&(user=="1500110001")) { login(); } hope newbie here. thank in advance! change usertype.getselecteditem() usertype.getselecteditem().gettext() , compare strings equals() , , change & && (for reasons mentioned @nicholassimon), this if(usertype.getselecteditem().gettext().equals("administrator") && (user.equals("1500110001"))

jquery - Here i am applying model validation and I want to stop post my form but its not working -

my form code on trying: @using (html.beginform("contactus", "home", formmethod.post, new { id = "frmcontactus", enctype = "multipart/form-data" })) { <div class="form_style"> @html.textboxfor(m => m.name, new { @placeholder = "name", @class = "inputtype" }) @html.validationmessagefor(m => m.name) </div> <div class="form_style"> @html.textboxfor(m => m.email, new { @placeholder = "email", @class = "inputtype" }) @html.validationmessagefor(m => m.email) </div> <div class="form_style"> @html.textareafor(m => m.message, new { @placeholder = "message", @class = "inputtype texarea"

node.js - Populating field values for referred documents in aggregate call in Mongoose -

i have 2 base schemas user , course //user model var userschema = new schema({ userid: { type: string, default: '', required: 'please provide userid.', index : true }, name :{ type: string, default: '', trim : true } }); //course schema var courseschema = new schema({ title: { type: string, default: '', required: 'please fill course title', trim: true, index: true }, description: { type: string, default: '', trim: true }, category: { type: string, ref: 'category', index: true } }); and usercourseprogress schema storing each user's course progress. var usercourseprogress= new schema({ userid: { type: string, ref:'user', required: 'please provide user id', index:true },

php - Sorting Array of Categories -

i'm attempting sort following array use in foreach loop outputs latest post each of categories of goose-creek, sleepy-creek, , fobr. i want sort array post date, i'm confused on how accomplish this. better add multiple categories wp_query args , remove foreach loop? $feed_sources = array('goose-creek','sleepy-creek','fobr'); foreach ($feed_sources $feed) { $args = array('category_name' => $feed, 'posts_per_page' => 1); $show = new wp_query($args); $show->the_post(); the following code uses associative array , outputs category key , date integer value. arsort() sorts array high low $feed_sources = array('goose-creek','sleepy-creek','fobr'); $dates_array = array(); foreach ($feed_sources $feed) { $args = array('category_name' => $feed, 'posts_per_page' => 1); $show = new wp_query($args); $show->the_post(); $dates_array[$feed] = the_date('ymdhis'

Android - storing contacts in my own list for the app to access -

my app let user selects contacts contact list in order perform action on them. when user selects contact, name + image + phone number , show in list inside app. i want store info/list somewhere internally app can access next time opens. how/where can this?

java - Change random operator or variable -

i have assignment in programming class. goes this, have make program takes input of user how many exercises wants do. solves simple calculations random numbers 1-10 , random operators. in end, should write how many correct , incorrect ones did get. should write elapsed time of task. did work, when assign random value operation int operation = (int)(math.random()*3)+1; or number , b int = (int)(math.random()*10); int b = (int)(math.random()*10); i same number , operator when choose second or third time task (because use loop). there way change same initialized variable or operator during program. example int a=(int)(math.random()*10) initialized in beginning example 3, , later when program loops again initialize different number, example 6. there others solutions problem? here whole code, now: import java.util.*; import javax.swing.joptionpane; public class randomchar { public static void main(string[] args) { char op= ' '; int operation =

How to store time from java.util.Date into java.sql.Date -

i want convert java.util.date java.sql.date want hours, minutes, , seconds java.sql.date can used store date(no time) . tried below code giving year, month, , day java.sql.date object. simpledateformat format = new simpledateformat("yyyymmddhhmmss"); date parsed = format.parse("20110210120534"); system.out.println(format.parse("20110210120534")); java.sql.date sql = new java.sql.date(parsed.gettime()); system.out.println("sql date is= "+sql); current output: 2011-02-10 desired output: 2011-02-10 12:05:34 the java.sql.date type used store date (no time) information, maps sql date type, doesn't store time. tostring() method is: formats date in date escape format yyyy-mm-dd. to achieve desired output can use java.sql.timestamp , stores date and time information, mapping sql timestamp type. tostring() method outputs need: formats timestamp in jdbc timestamp escape format: yyyy-mm-dd hh:mm:ss.fffffffff,

sql - Remote mysql not executing query: how to make it simpler? -

the query listed below running fine on localhost it's somehow hanging when executed remotely targeting service provider database (both php script , sql query in phpmyadmin console hang), although every chunk returning expected table when run individually. what's wrong? suggestions on how make shorter or simpler , remote mysql? select * `table1` `tag1` in ( select distinct `tag1` `table2` `tag1` not in ( select `tag1` `table2` `tag2` = '$keyword' ) )

hp uft - UFT and HP ALM connectivty -

i have installed hp uft v12.01 , when trying connect via hp uft hp alm quality center v11.0 , following error: failed update components server. failed hosting spider activex any suggestions? if logging alm first, , connecting alm through uft not work (as suggested vvvaib above), try this: - open uft administrator (right-click on icon, select "run administrator") , try logging alm.

arrays - Matlab: Sum corresponding values if index is within a range -

i have been going crazy trying figure way speed up. right current code talks ~200 sec looping on 77000 events. hoping might able me speed because have 500 of these. problem: have arrays (both 200000x1) correspond energy , position of hit on 77000 events. have range of each event separated 2 arrays, event_start , event_end. first thing position in specific range, put correspond energy in own array. need out of information, loop through each event , corresponding start/end sum energies each hit. code below: indx_pos = find(pos>0.7 & pos<2.0); energy = hitenergy(indx_pos); i=1:n_events etotal(i) = sum(energy(find(indx_pos>=event_start(i) … & indx_pos<=event_end(i)))); end sample input & output: % sample input % pos , energy same length n_events = 3; event_start = [1 3 7]'; event_end = [2 6 8]'; pos = [0.75 0.8 2.1 3.6 1.9 0.5 21.0 3.1]'; hitenergy = [0.002 0.004 0.01 0.0005 0.08 0.1 1.7 0.007

Android - Is it correct to use Event Buses (like Otto) for UI elements communication? -

can (is correct to) use event bus communicate between ui views? exemple, use communicate between fragments instead of implementing listener? can use same instance of bus more 1 operation? thank you yes. otto built reason: communicate fragments , activities aside without need of serializing through intent s. also, instance question: can reuse bus wherever want to. sometimes, though, prefer create different buses separate groups of classes communicating: example, in mvp architecture, have bus each m-v-p group, or in example, bus communicating specific service running, etc. this example on how use library.

Converting input String to int array with Variable length in java -

here snippet of code. want of user number variable length , convert int array. example: input: 352040 , output:{3,5,2,0,4,0} scanner in = new scanner(system.in); system.out.println(" enter size number: "); int length = in.nextint(); system.out.println(" enter number: "); int number = in.nextint(); int[] intarray = null; string str = integer.tostring(number); ( int =0; < length ;i++) intarray[i] = integer.parseint(string.valueof(str.charat(i))); system.out.println(arrays.tostring(intarray)); this comes error(exception in thread "main" java.lang.nullpointerexception) , cant understand why. thanks help. you need create array first. int[] intarray = new int[length]; // create array string str = integer.tostring(number); ( int =0; < length -1;i++) intarray[i] = integer.parseint(string.valueof(str.charat(i)));

ruby - Trouble installing compass for sass/scss -

i on mac (yosmite) , in terminal trying install compass can start using sass. run: sudo gem install compass and huge error: caspars-mbp:~ casparwylie$ sudo gem install compass building native extensions. take while... error: error installing compass: error: failed build gem native extension. /system/library/frameworks/ruby.framework/versions/2.0/usr/bin/ruby -r ./siteconf20150401-47466-qqmsir.rb extconf.rb checking ffi.h... *** extconf.rb failed *** not create makefile due reason, lack of necessary libraries and/or headers. check mkmf.log file more details. may need configuration options. provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/system/library/frameworks/ruby.framework/versions/2.0/usr/bin/ruby --with-ffi_c-dir --with

Output hash-table without @{var=...} when parsing .xml files in Powershell -

i'm new powershell, , trying parse .xml file using code below: [xml] $alloc_macro = get-content ".\allocation_macro.xml" $newlist = @() foreach ($layer1 in $alloc_macro.dmob.module.macro.block[4].block) { $condition = ($layer1 | select condition) foreach ($layer2 in $layer1.for) { $var = ($layer2 | select var) $in = ($layer2 | select in) $newlist += new-object -typename psobject -property @{ condition = $condition; var = $var; in = $in } } } $newlist here's result: condition var in --------- --- -- @{condition=@[allocationflag]} @{var=allocationnumber} @{in=*[eq](##personalnonpersonal##,"personal",@[a... @{condition=*[not](@[allocationflag])} my question is, can this: con

javascript - How to disable and enable jquery validations in a same view -

i have view consists 3 blocks of code. each block contains 'required' java script validation fields. requirement user can submit form after filling 1 block. if press submit validations in second block , third block validations should disabled in mvc. can give me idea?

asp.net - log4net rolling file appender not working -

i have following configuration: <log4net> <root> <level value="all"/> <appender-ref ref="rollingfileappender"/> </root> <appender name="rollingfileappender" type="log4net.appender.rollingfileappender"> <file value="mylog.log"/> <appendtofile value="true"/> <preservelogfilenameextension value="true"/> <rollingstyle value="composite"/> <datepattern value=".yyyymmdd"/> <maximumfilesize value="5mb"/> <countdirection value="1"/> <maxsizerollbackups value="-1"/> <staticlogfilename value="false"/> <layout type="log4net.layout.patternlayout"> <param name="conversionpattern" value="%date [%thread] %-5level %logger - %message%newline"/>

node.js - use hiredis for node_redis -

i using node_redis https://github.com/mranney/node_redis it says pieter noordhuis has provided binding official hiredis c library, non-blocking , fast. use hiredis, do: npm install hiredis redis i follow instruction , compile hiredis, found hiredis.node located in /node_modules/hiredis/build/release/hiredis.node . but node_redis located @ /node_modules/redis i afraid node_redis can find hiredis.node c library. question : how can determine if node_redis using hiredis parser? should move hiredis.node /node_modules/redis directory? should yum install hiredis ? not sure if hiredis.node uses hiredis static library or dynamic library. according documentation have npm install hiredis redis var client = redis.createclient(options); console.log(client.reply_parser.name); // retrieve parser name check test file in benchmarks folder edit: can pass parser in options, did in link above l27-31 var options = { parser: 'hiredis' };

json - django rest framework view with merged results from different object serializers -

having following models class treelifephase(dbordered): name = models.charfield(max_length=200) def __unicode__(self): return self.name class treewidth(dbordered): name = models.charfield(max_length=200) def __unicode__(self): return self.name and many more this, contain editable attributes of tree objects. select field on ui want have available treelifephases , treewidths 1 query - have json result looks like { "treelifephases": [ { "id": 1, "name": "young" }, { "id": 2, "name": "medium" }, { "id": 3, "name": "old" } ], "treewidths": [ { "id": 1, "name": "10-20cm" }, { "id": 2, "name&quo

ruby on rails - PaperclipOpenURI::HTTPError (403 Forbidden) with Amazon S3 Storage -

i have images stored in s3 paperclip , error intermittenly showing up. had resolved few weeks ago upgrading ruby 2.1.5, it's now. here's controller code: def download extension = file.extname(@gallery_photo.image_file_name) send_data open("#{@gallery_photo.image.expiring_url(10, :original)}").read, filename: "original_#{@gallery_photo.id}#{extension}", type: @gallery_photo.image_content_type end here's error: openuri::httperror (403 forbidden): rails 4 & ruby 2.1.5 i had extend expiring_url 10000.

ios - Tab bar's navbar stuck under custom navbar? -

Image
i implementing custom nav bar of application, transition tab bar based navigation paradigm other portions of app. when switch tab bar portion of app , navigate "more" section of tab bar controller, navbar has "edit" button of more section obscured custom navbar. i have tried removing navbar view, bringing tab bar's navbar top of view, etc. the goal here gain access edit button's functionality in order rearrange icons on tab bar. i'd either invoke edit functionality of tab bar programmatically or bring tab bar's navbar front of view. thanks in advance!

c# - how to assign int value to SELECT database string? -

i used dataadapter use select common choose rows of table oledbdataadapter objdataadapter = new oledbdataadapter("select * table daynum = @daynum", objconnection); //here daynum must equal 10; daynum = 10 i want assign integer value @daynum for example int intday = 10; objcommand.parameters.addwithvalue(intday.tostring(),"@daynum"); but don't work how can fix problem? remove .tostring() . try this: objcommand.parameters.addwithvalue("@daynum",intday);

java - Retrofit: Error deserializing array with one element: "out of START_ARRAY token" -

i writing android app utilizing robospice, retrofit, , jackson 2.4.x, here json trying deserialize coming rest service. elements in "data" array returned notification object want deserialize. { "data": [ { "uuid": "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx", "acctno": "xxxxxxxxxx", "title": "test notification", "content": "here content.", "date": "2015-03-24" } ] } i first wrapping response in notificationresponse object: @jsonrootname(value = "data") @jsonignoreproperties(ignoreunknown = true) public class notificationresponse { @jsonunwrapped public notification[] notifications; } notification object looks this: public class notification { @jsonproperty("uuid") public string uuid; @jsonproperty("acctno") public string acctno; @

Python + Selenium + PhantomJS => Problems loading and rendering pages with local development server -

i'm saving screenshot when page loaded. if test production, works ok (the page rendered correctly). but , if test local development server, page isn't rendered correctly when check screenshot. some elements (html, images) missing. the problems phantomjs. if use firefox, works ok. need 'headless', because it's requirement. i'm using python 2.7.6 + selenium 2.45.0 + phantomjs 1.9.8 (os x yosemite 10.10). code : import unittest import time selenium import webdriver class test(unittest.testcase): headless = 1 development = 1 def setup(self): if self.headless: self.driver = webdriver.phantomjs() self.driver.set_window_size(1400, 1200) else: self.driver = webdriver.firefox() self.driver.maximize_window() self.driver.implicitly_wait(100) url = 'http' if self.development: url += '://development.localhost.lan:3000/login'

Lua need to read the file, which I just wrote in same program -

need write file, open reading , write lines file - in 1 script. problem is, i: open file1 in read mode (file1=io.open("my_file.txt","r")) open file2 in write mode (file2=io.open("my_changed_file.txt","w")) write changed content file1 file2 open file2 (tried open file3=io.open("my_changed_file.txt","r")) in read mode , print lines example i tried several ways, file2:flush(), or file2:close() , re-open after finished writing, returns nil when want print lines file1=io.open("my_file.txt","r") file2=io.open("my_changed_file.txt","w") line in file1:lines() file2:write(line.."changes") end file2:flush() file3=io.open("my_changed_file.txt","r") --write several lines file or --(need combine changed lanes file2 , original lines file1 based on key) i've tried script minor changes in lua 5.1, 5.2, , 5.3 , works expected in versions. sc

Cassandra Table design for Historical state information -

my requirement design table historical state information (not time-series). ex: have devices connecting , disconnecting management platform. want know details such (name, mac address, os, image, etc.) devices connected management platform in given interval (start , end time). any on table design use-case? if want know if connected during interval, should work in traditional time series approach: create table device_state( deviceid, timeofevent, state, details, primary key (deviceid, timeofevent, state) select details device_state timeofevent > '2001-01-01 12:01:01.000' , timeofevent < '2001-01-01 12:15:59.000' , state = 'connected'; if want know if device connected entire time, need implement client side logic.

ruby - Converting JSON hash into URL to be used in rails view -

i using api has url in response (a json hash). i'm trying take response, parse url , use url in link_to helper in rails view. current json parsing isn't doing trick. # response {"url":"https://demo.foobar.net/t=54e85a9f-008b-481c-986d-69881208713e"} # controller action parse @url = json.parse(response.to_json) # rails view <%= link_to "sign document", @url %> # rendered html <a href="/?url=https%3a%2f%2fhttps://demo.foobar.net/t=54e85a9f-008b-481c-986d-69881208713e">click here!</a> i need parse json hash ensure output of rails link_to helper is: <a href="https://demo.foobar.net/t=54e85a9f-008b-481c-986d69881208713e">click here!</a> why converting response json , parsing again. u can value of url @url = response["url"]

node.js - Sails.js How to insert data into a join table (Many to Many) -

i having error inserting data join table , don't know if i'm doing right way. here 2 models have many many association. commit.js: module.exports = { schema: true, attributes: { idcommit : { type: 'integer', autoincrement: true, primarykey: true, unique: true }, revision : { type: 'integer', required: true }, issues: { collection: 'issue', via: 'commits', dominant: true } } }; issue.js: module.exports = { schema: true, attributes: { idissue : { type: 'integer', autoincrement: true, primarykey: true, unique: true }, description: { type: 'string', required: true }, commits: { collection: 'commit', via: 'issues' } } }; when try insert issues commit way : commit.create(commit).exec(function(err,created){ if (err) { console.log(err); } else {

java - Editable JavaFX ListView -

i'd make editable listview. documentation indicates setting editable=true insufficient, , wasn't able find example anywhere. in fxml have: <listview fx:id="queuelistview" editable="true"/> what else need (in fxml or in controller) make happen?

opening Internet Explorer using c programming language -

i made c program in used notorious system () function open internet explorer.there no error compiled giving me output illegal command. problem?? have rechecked internet explorer address in c drive perfect. how solve this? i guess have specified path internet explorer this "c:\program files\internet explorer\iexplore.exe" but because \ character "escape" character in literal string, need defeat escape "c:\\program files\\internet explorer\\iexplore.exe" there no error when compiled because compiler cannot check whether command passed system() meaningful, or valid @ runtime.

MIPS Assembly Array of Pointers -

i'm trying create array of pointers correspond list of names, , parallel array keeps track of how many times names have been displayed. i'm not looking method display them, know how load pointer array, , load array of ints start 0's. define names in list of null terminated strings , set aside memory arrays, i'm not sure how put addresses of names array. here's have: .data .space 5000 listofnames: .asciiz " jones \n" .asciiz " smith \n" .asciiz " johnson \n" .asciiz " davis \n" .asciiz " reid \n" .asciiz " foster \n" .asciiz "#" # indicates end of name list, can grow in size .space 400 .align 2 # should 2? thought should word aligned pointer_array: .space 400 .align 2 # should 2? thought should word aligned parallel_array: as @jester suggests, can use labels assembler compute address of each name, , use labels define in array. another possibility set asid

excel - Return headers if column contains certain string -

i have sheet called input. top row, a1:o1 contains parent, , rows underneath (of varying length) contains urls. of urls shared between parents, , want return list of urls, , parents are. have tried concatenate(if(index(match formula becomes large. similar questions i've seen looking 1 output, number. open vba solutions, have very minimal understanding create own code. example: news --- celebrity ---- finance cnn------complex --------forbes forbes---cnn i want return cnn news celebrity, forbes new finance, complex celebrity. don't mind how output formatted. since have data in a:o, assuming column q blank. in column q, make list of unique values (so in example, q1 "cnn", q2 "complex" , q3 "forbes". can use "remove duplicates" list of unique urls). code loop through used range column o (from row 2 last used row) , put "answer" in column r. sub test() dim headerrange range, uniquename string, integer, totaln

How can I add horizontal-space in between columns, when using python to append several lists onto a file? -

for item in zip(xcoords, ycoords, zcoords): out = open("file.txt", "a") print (item) out.write( "ar" "%s %s %s \n" %(item)) out.close() i want 4 columns separate each other. code prints, ar123 ar213 ar312 have tried adding space this: item in zip(xcoords, ycoords, zcoords): out = open("file.txt", "a") print (item) out.write( "ar" " " "%s " " %s " " %s \n" %(item)) out.close() note added space putting " " in between.

windows 7 - Powershell to Script to Add Part of a Grandparent Folder to Child Item Names -

at work, maintain large (500+) file system of company's clients. each client has own folder, subfolders years, , account files in each year folder. on client's folder, their name , six-digit identifier number. facilitate upcoming audit, asked attach 6 digit identifier number on grandparent folder each of child item account files. there way specify portion of grandparent's folder add child item? if so, script? p.s. apologize, new coding, i'm actively trying learn powershell. sounds need learn regular expressions . $grandparent = 'c:\bobby 123456\2014\bobby 15-5555' if ($grandparent -match 'c:\\(?<name>.*)\s(?<idcode1>\d{6})\\(?<year>\d{4})\\.*\s(?<idcode2>\d{2}-\d{4})'){ $matches.name $matches.idcode1 $matches.year $matches.idcode2 "{0} {1} {2}" -f $matches.name,$matches.idcode2,$matches.idcode1 } here favorite reference regex .

ios - Different UINavigatonBar buttons/title for viewcontrollers inside UITabBarController -

Image
i'm working on application utilizes uitabbarcontroller embedded in uinavigationcontroller (w/ 3 children view controllers). i want each of these child vc's display different things on navigation bars (different titleviews, buttons, etc), yik yak's interface (those vc's in tab bar controller well): right now, navigation bar isn't functioning correctly between switching tabs, instead each time switch between tabs, presented view controllers nav bar settings override previous 1 (if hasn't been set yet). if has, displays current nav bar settings. abstractly, app structure this: uinavigationcontroller -> uitabbarcontroller -> uiviewcontroller #1 -> uiviewcontroller #2 -> uiviewcontroller #3 i setting each view controller's nav bar settings in viewdidload example: - (void)viewdidload { self.tabbarcontroller.navigationitem.titleview = _segme

.net - App with windows auth asks for login -

i have auth set windows because running on company intranet. web.config looks like: <authentication mode="windows" /> <authorization> <deny users="?" /> </authorization> i building in vs 2013. each day, first time run app pops auth required login box , once give windows creds, fine (i assume caches creds). want app start , not ask valid user login creds. i thought behavior of windows authentication. there iis express setting need change? else needed in web config? you have configure web application domain "local intranet" site in internet explorer (chrome inherit setting ie, believe firefox have configured manually). can accomplished through "internet options --> security --> local intranet --> sites --> advanced --> add website". you need configure automatic logon outlined in link: https://technet.microsoft.com/en-us/library/dd572939%28v=office.13%29.aspx?f=255&mspperror=-214

python - Matplotlib: use a colormap to show concentration of a process around its mean -

Image
i have pandas dataframe contains 100 realization of given process, observed @ 10 different dates (all realization start same point @ date 0). such dataframe can generated with: import pandas pd import numpy np nbdates = 10 nbpaths = 100 rnd = np.random.normal(loc=0, scale=1, size=nbpaths*nbdates).reshape(nbdates,nbpaths) sim = dict() sim[0] = [100.0] * nbpaths t in range(nbdates): sim[t+1] = sim[t] + rnd[t] sim = pd.dataframe(sim) now know can plot 100 paths contained in dataframe this sim.t.plot(legend=false) and obtain graph this: but plot minimum , maximum of process @ every date, , color area between 2 extremas color map reflect concentration of paths in plot (so instance red around mean , gradually cooler go extremes). i have looked @ using colormaps achieve this, have not managed yet. if knows straightforward way helpful. thank ! you can (albeit not in elegant way) first making contour plot of "concentration" contourf , making line plot

c# - Download image from Wikimedia -

i've read documentation , after research im not sure if there easy way this. i using musicbrainz image of artist. produces url https://commons.wikimedia.org/wiki/file:michael_jackson_in_1988.jpg i download image ( which have worked out ) dont know how or correct procedure be? i have read few links , seem pretty dated including: download image site in .net/c# which doesnt answer question have way of downloading image. im after in case way of getting image url using above link contains download links. i did read link targeting api again dated , ready pages didnt mention api (so have been third party). i have download image, getting correct url can found on link posted above dont know how extract url? you use html agility pack <a href elements in html page , ones image type extension. var document= new htmlweb().load("https://commons.wikimedia.org/wiki/file:michael_jackson_in_1988.jpg"); var allhrefs = document.documentelement.selectnodes(

Sybase code has has where clause: where a & b=c -

i have code below: select id,role,unit user_id i,user_rol r,unit u unit_grp_catg_map_c & ib_unit_grp_catg_c = ib_unit_grp_catg_c can explain me & , how works? cannot find on internet & stands bitwise , operation, here have details.

ios - "This bundle is invalid - The file extension must be .zip" error submitting to iTunes -

the last 24 hours, every time submit ios app, i'm getting error (after successful upload/acceptance) "this bundle invalid - file extension must .zip" and binary flagged invalid. i've successful submitted many times through testflight, , prior build entered app review. last successful submission 2 days ago. don't remember making significant changes project, changes xcode turned on automatic updates in xcode , downloaded documentation. i've cleaned project, deleted derived data, restarted xcode, restarted mac. i not using cocoapods, trigger problem in other question i've found error message. using swift, , building ios keyboard extension, again have had no problem uploading months. i'm not sure start debugging this, cocoapods answer mentioned spaces in build names, haven't changed can rememeber, , app's name , no file in project has space in names. suggestions how debug this? this happened me last week , i wrote it . i th

projection - MongoDB - Projecting a field that doesn't always exist -

is there way project fields may or may not exist? such having defined null or undefined? for instance, doing query with: $project: { date: 1, name: "$person.name", age: "$person.age" } not documents guaranteed have $person.age, instead of ones without age being returned { date: today, name: "bill" }, { date: today, name: "bill", age: null }. or similar. is there better way iterating through data afterwards , creating fields if don't exist? use $ifnull $project: { date: 1, name: "$person.name", age: { $ifnull: [ "$person.age", "null" ] } } you can find more here

r - How to name foreach matrix columns? -

just question neat way name result matrix of foreach loop. works, it's bit verbose, wonder if there simpler method: r = foreach( i=seq(5), .combine=rbind, .final=function(res) { colnames(res) = c("first", "second"); return(res) } ) %dopar% { c(i, i+1) } put column names in rhs of %dopar% : foreach(i=seq(5), .combine=rbind) %dopar% { c(first=i, second=i+1) }

templates - Unit Testing in Nim: Is it possible to get the name of a source file at compile time? -

i'm planning project multiple modules, , looking nice solution run existing unit tests in project @ once. came following idea: can run nim --define:testing main.nim , use following template wrapper unit tests. # located in general utils module: template rununittests*(code: stmt): stmt = when defined(testing): echo "running units test in ..." code this seems working far. as minor tweak, wondering if can print out file name calling rununittests template. there reflection mechanism source file name @ compile time? instantiationinfo seems want: http://nim-lang.org/docs/system.html#instantiationinfo , template filename: string = instantiationinfo().filename echo filename()

PowerShell v3 Managing Share/NTFS Permissions -

background: i've been trying write powershell script add/remove permissions folder. script 5th script in sequence of scripts kick off after another. scripts have shared variables, etc. scripts follows: create ad group object create ad user object (or two, three, four, etc.) create user folder on application server , create data folder (to shared associated users) on file server this script, change permissions supposed be i'm trying following (ntfs): user folder - system (full), administrator (full), domain admin (full), ad group (modify), users (modify) data folder - system (full), administrator (full), domain admin (full), ad group (modify), network service (full), users (read) i'm trying following (share): data folder - system (full), administrator (full), domain admin (full), ad group (modify) here i've been trying work with: if use method locally, works great. shares folder such "c:test" without issue. can't run against