Posts

Showing posts from September, 2013

c - Marienbad game wrong XOR -

i working on programming puzzle, need code ai best current move win game. the loser 1 picks last sticks. here board : | ||| ||||| | so use xor operator on numbers number of sticks need remove give me : 1 xor 3 xor 5 xor 1 = 6 now : 1 xor 6 = 7 (since increased won't select case) 3 xor 6 = 5 (since increased won't select case) 5 xor 6 = 3 (since decreased reduce 5 3 removing 2 sticks. the problem playing in "misere" version of game loser if 1 take last sticks , seems method perfect normal play winner 1 take last stick. could explain me should in case. the winning strategy isn't xor piles , remove many sticks 1 pile. instead, want choose number of sticks remove such xor of piles zero. example, if remove 2 sticks pile containing 5 sticks, remaining xor 1 xor 3 xor 3 xor 1 = 0. hope helps!

c++ - Making templatized optimization more maintainable -

sometimes piece of code can better-optimized compiler using templatized internal implementation invariant. example, if have known number of channels in image, instead of doing like: image::dooperation() { (unsigned int = 0; < numpixels; i++) { (unsigned int j = 0; j mchannels; j++) { // ... } } } you can this: template<unsigned int c> image::dooperationinternal() { (unsigned int = 0; < numpixels; i++) { (unsigned int j = 0; j < c; j++) { // ... } } } image::dooperation() { switch (mchannels) { case 1: dooperation<1>(); break; case 2: dooperation<2>(); break; case 3: dooperation<3>(); break; case 4: dooperation<4>(); break; } } which allows compiler generate different unrolled loops different channel counts (which can in turn vastly improve runtime efficiency , open different optimizations such simd instructions , forth). h

extjs - Possible to filter user stories on name starts with? -

is possible filter user stories on name? example: filters: [{properrty: 'name', operator: 'startswith', value: 'epic'}] i using 2.0p5 rally sdk. there documentation can @ app sdk? explains querying on different attributes? there isn't startswith operator, can use contains: filters: [{property: 'name', operator: 'contains', value: 'epic'}] all possible values filter operators can found here: https://help.rallydev.com/apps/2.0p5/doc/#!/api/rally.data.queryfilter-cfg-operator you can use filterby method further narrow down result set once store has been loaded server: store.filterby(function(record) { return record.get('name').indexof('epic') === 0; }); the full app sdk documentation (including guides , links wsapi documentation) can found here: https://help.rallydev.com/apps/2.0p5/doc/ i recommend upgrading recent version of sdk app development (2.0rc2 of writing). https://help.rall

php - Most efficient way to do batch INSERT IGNORE using doctrine 2 -

i have script needs go list of entries in database iterate on creating new entries in table if dont exists. currently im doing: foreach($entries $entry){ $newitem = new item(); $newitem->setattribute($entry->getattribute()); $entitymanager->persist($newitem); try{ $entitymanager->flush(); } catch(\exception $e){ if(!strpos($e->getmessage(),'duplicate')){ throw $e; } $entitymanager = $this->getdoctrine()->getmanager(); //refreshes entity manager } } however doing way time intensive, there 1000's of entries , script times takes upwards of 10 minutes complete. have seen other posts suggest when doing batch processing flush every 20 or records problem if 1 of 20 duplicate whole transaction dies, im not sure how go , try , find offending entry exclude before resubmitting them again. any appreciated. you can 1 select fetch records exist in database, , later ski

Wordpress Custom Post Types and fields -

i have 2 custom post types… book , book author. i want to… list book's author on respective author page. so if have 10 books stephen king. want list them (and him) on stephen king page. having real trouble working out how query posts this. any advice? using advanced custom fields plugin if helps, can't work out how query , display post information. i use following code display of releases, how specific ones on specific author pages? <?php $args=array( 'post_type' => 'book', 'post_status' => 'publish', 'posts_per_page' => 12, 'caller_get_posts'=> 1, 'orderby'=> 'date', 'order' => 'desc' ); $my_query = null; $my_query = new wp_query($args); if( $my_query->have_posts() ) { echo ''; $i = 0; while ($my_query->have_posts()) : $my_query->the_post(); if($i % 6 == 0) { ?> <

css - Fixed header position in bootstrap 3 modal -

i want use fixed header in bootstrap modal, if set .modal-header position:fixed scrolls along moda content. how create trully fixed header in bs modal? instead of trying make header fixed, fix height of body , make scrollable. way header (and footer) visible. you can using css3 vh unit calc . both vh calc have pretty browser support (ie9+). the vh unit relative viewport (= browser window) height. 1 vh 1% of height , 100vh means 100% of viewport height. we need substract height of modal's header, footer , margins. it's going difficult dynamic. if sizes fixed, add heights. set either height or max-height calc(100vh - header+footer px) . .modal-body { max-height: calc(100vh - 210px); overflow-y: auto; } see jsfiddle

linux - Using wget on a directory -

i'm new shell , i'm trying use wget download .zip file 1 directory another. file in directory copying file .zip file. when use wget ip address/directory downloads index.html file instead of .zip. there missing download .zip without having explicitly state it? wget utility download file web. you have mentioned want copy 1 directory other. meant on same server/node? in case can use cp command and if want if other server/node [file transfer] can use scp or ftp

html - Make two elements inside <ul> tags responsive on the same line -

i know how make 2 div's inside tags responsive, @ same time elements have stay on same line. right right div going below first one. here jsfiddle example: http://jsfiddle.net/vladicorp/vzssp/3/ the code: <div id="design01"> <div id="titledesign01">title</div> <ul> <li> <div id="designphoto01"><img src="http://www.emocool.com/work/01.jpg" ></div> </li> <li> <div id="designphoto04"><img src="http://www.emocool.com/work/03.jpg" ></div> </li> </ul></div> the css: #design01 { display: block; position: relative; max-width: 100%; margin: 0 auto; float:left; } #design01 ul { float:left; overflow:hidden; max-width: 100%; height:100%; list-style:

java - Setting unique timers in for loop -

i using loop , setting timer @ beginning, , ending @ end. loop repeats 3 times , gives me 3 values need want able compare timer values gives me in java , compute results biggest-smallest. that, need each timer have unique name cannot seem do. here example of code. int j; for(j=1;j<=3;++j){ //...code { long starttime = system.nanotime(); //timer start //...code long estimatedtime = system.nanotime() - starttime; //timer end system.out.println(starttime + "_1"); } { timer comparison 3 timers } as said, have values, need way compare them. "estimatedtime" value i'm comparing, ideally assign names "estimatedtime2" , "estimatedtime3" on second , third values. you cannot declare variable different name "on fly", have save estimated time in array or other data structure (e.g., list) , index accordingly. for example, do: long[] times = new lo

c# - Bind a gridview to a table with some logic built into the table? -

i have gridview , datatable. simple binding, right? want color code specific cells on gridview based on values of cells. know can on row databound event, means have logic on gui side. there way bind datatable table having info formatting gridview cell? ideally, i'd find way pass "value:color" combination each cell on binding, gridview pick color each cell. can done? from database select case columnname when somevalue '<span style="background-color:red">' + columnname + '<\span>' else columnname end thecolumn then in gridview itemtemplate <asp:label text='<%#eval("thecolumn")%>' runat="server">

iphone - How to get local player score from Game Center -

how score of local player leaderboard game center? tried code, returns nothing. know how solve it, or there better way how score? - (nsstring*) getscore: (nsstring*) leaderboardid { __block nsstring *score; gkleaderboard *leaderboardrequest = [[gkleaderboard alloc] init]; if (leaderboardrequest != nil) { leaderboardrequest.identifier = leaderboardid; [leaderboardrequest loadscoreswithcompletionhandler: ^(nsarray *scores, nserror *error) { if (error != nil) { nslog(@"%@", [error localizeddescription]); } if (scores != nil) { int64_t scoreint = leaderboardrequest.localplayerscore.value; score = [nsstring stringwithformat:@"%lld", scoreint]; } }]; } return score; } i think, method have wait completion of [leaderboardrequest loadscoreswithcompletionhandler: ... is possible? your code a

javascript - jQuery / Attach a div element inside another element and target/control the parent one -

for mobile version of website i’m using jquery create div element (close button) inside div (checkbox elements): var $newdiv = $("<div/>") .addclass("closebtn") .html("close [x]"); $(".checkbox_elements").prepend($newdiv); this works fine when add click function div inside (close button), can’t "hide" parent div (checkbox elements): $(".closebtn").click(function(){ $(".checkbox_elements").css("display", "none"); //or $(this).prev(".checkbox_elements").css("display", "none"); }); when attach close button other element outside checkbox elements div works fine. how can click function work inside checkbox elements div container? thanks support! since button( closebtn ) added dynamically, need try event delegation $('.checkbox_elements').on('click', ".closebtn&

gem - Odd behavior from Ruby's require -

i'm writing ruby gem lots of nested classes , such. i'd keep huge list of require statements out of main ruby file in /lib directory, instead used following: dir[ file.join( file.dirname(__file__), "**", "*.rb" ) ].each {|f| require f} which totally worked fine until morning when added new file (helper module) , library acting file isn't loaded, though is. checked with puts "loaded" if defined?(realtimearghelpers) i duplicated require statement check see if new file getting returned dir[ file.join( file.dirname(__file__), "**", "*.rb" ) ].each {|f| puts f} and is. have manually require 1 file. out of nowhere. have 101 other files being gathered statement , works fine. not 1 file. don't have name conflicts besides /path/arg_helpers.rb /path/realtime/agents.rb /path/realtime/queues.rb /path/realtime.rb /path/realtime_arg_helpers.rb which still shouldn't 'conflict.' i'm baffled seemingl

mysql - INSERT new row or DELETE old row IF it already exists -

i need optimize/implement mysql query wich following: i need store if user marked item seen, , create seen/unseen button, delete correspondent row on database if exists (is marked seen) or insert new row if not (is not marked). it means, need mysql query that: delete table userid = ? , itemid = ? or that insert table (userid, itemid) values (?,?) depending on if row exists or not. i it's easy doing php , checking number of rows of select before insert or delete doing optimized can. you can use stored procedure select , delete if exists or insert. easier left data there , update seen/unseen on duplicate key update .

YouTube Android player API demo only show 'There are a problm while playing' -

i tested youtube android player api demo player show 'there problem while playing' , working well. but below code return success. youtubestandaloneplayer.getreturnedinitializationresult(data); used test api key aizasyb3loh381o8f64br9dc-c15vmzpcl1za5a (any application allowed) download : https://developers.google.com/youtube/android/player/downloads/ i know youtube android player api demo working before, think has big problem now. how can help? check android developer console api key, it's different api key between debug , publish keystore need create 2 api key. 1 debug (install eclipse) , other apk (install apk or google play), , check package name same api key

javascript - Node.js Global Dev Side Constant -

i want make global constant can access them anywhere, i.e. server-side , client-side code. is there module makes easy? i'm looking global dev side constants, meaning not need change , in fact great if can compile files inject variables inline when need go production.

javascript - Aligning Text in CSS/JS menu -

i'm trying align text in menu at: http://crango.uofydating.com/dir/new2.html in 1st tab, want there line break after "item". in 2nd , 3rd tab, want there line break after "this is". i posted part of menu need with, may bit odd. connected javascript code makes more challenging edit. js can't removed. here solution i have created fiddle you use .html() instead of .text() code: .html('<strong>' + $(this).find('a').html() + '</strong>') it works great ;) check it fiddle http://jsfiddle.net/krunalp1993/yl6tn/1/ hope helps :)

how to use powershell to copy file and retain original timestamp -

i copy files or folder of files 1 file server another. however, want keep original timestamp , file attributes newly copied files have same timestamp of original files. in advance on answer. here's powershell function that'll you're asking... absolutely no sanity checking, caveat emptor ... function copy-filewithtimestamp { [cmdletbinding()] param( [parameter(mandatory=$true,position=0)][string]$path, [parameter(mandatory=$true,position=1)][string]$destination ) $origlastwritetime = ( get-childitem $path ).lastwritetime copy-item -path $path -destination $destination (get-childitem $destination).lastwritetime = $origlastwritetime } once you've run loaded that, can like: copy-filewithtimestamp foo bar (you can name shorter, tab completion, not big of deal...)

Jquery code to check an element is exist in json -

i want check element exist in json data doing $.get('/geteststatus', getdata, function (data) { if (data != "" || data[0].status ) { }); where getdata unique id am getting error typeerror: data[0] undefined if (data != "" || data[0].status) {} json data contains 1 row value.it not contain multiple values.so used data[0] checking json data {"id" : "12" , "status" : "gc", "_id" : objectid("52f3045873e7e96b18000005") } since data object, have use if(!data || data.status){ }

php - Elegant Efficient way of inserting into a lot of tables MySQL -

i making survey , database has 19 tables , 100 columns. of them inserted required fields. looking elegant , efficient way of inserting many tables , columns. far have come create multidimensional array contains first key table name , second key column name field. below: $tablearray = array( 'ownertable' => array( 'firstnamerow' => $firstname, 'lastnamerow' => $lastname ), 'dealertable' => array( 'dealernamerow' => $dealername, 'dealercityrow' => $dealercity ) ); foreach($tablearray $row => $key) { foreach($tablearray[$row] $row1) { $sql = "(insert $tablearray[$key] ($tablearray[$row]) values ($row1)"; } } i didn't test code thinking along lines work. think 1 problem see separate insert each column instead of 1 insert each table. can work on writing code load values array @ once

oop - Using reflection to call a method and return a value -

using question calling method name starting point, wanted call method name , value. package main import "fmt" import "reflect" type t struct{} func (t *t) foo() { fmt.println("foo") } type mystruct struct { id int } type person struct { name string age int } func (t *t) bar(ms *mystruct, p *person) int { return p.age } func main() { var t *t reflect.valueof(t).methodbyname("foo").call([]reflect.value{}) var ans int ans = reflect.valueof(t).methodbyname("bar").call([]reflect.value{reflect.valueof(&mystruct{15}), reflect. valueof(&person{"dexter", 15})}) } playground link, http://play.golang.org/p/e02-kpdq_p however, following error: prog.go:30: cannot use reflect.valueof(t).methodbyname("bar").call([]reflect.value literal) (type []reflect.value) type int in assignment [process exited non-zero status] what should differently return value? tried us

indexing - Is there a way to directly access a MariaDB or MySQL table index? -

i've read somewhere in recent months there project(s) integrates mysql or mariadb allowed direct index access performance optimization. specifically, kind of interface allow directly things like: "give me id of record indexed column matches blah" or "does id of value exist in specific index" ...and allows bypassing sql query parsing, planning, etc. steps, , gain higher throughput speed-sensitive operations. i can't seem find googling around it. familiar projects doing this? looking links open source sort of thing. (am dealing mysql [or 1 of it's derivatives], other open source projects might relevant well.) background info: i've ready on highscalability.com , other places of shops moving traditional rdbms nosql-style solution (or deciding go nosql @ start of new project) later regret , find advantages of nosql not outweigh drawbacks of having build around storage platform doesn't support flexibility of sql (basically: it'

cscope basic key behavior - can it be configured? (NOT vim related) -

i'm using cscope 15.7a on mac. 1) go different search field, have press return. have sworn in past didn't "[a" , "[b" in output if used up/down keys. , maybe tab moved between fields. 2) when search results, can't select result open navigating , down cursor , pressing enter. have select based on result number (a-z, 0-9). i don't recall behavior in past don't remember cscope being counter-intuitive/unnatural. there way modify key actions? (note, nothing vim key mappings) this bug in 15.7a. fixed: https://trac.macports.org/ticket/31835 currently macports on 15.8a. should work.

ios - UIprogressView Status based on text entered on UITextfield -

i progress uiprogressview status based on text entered in uitextfield . if entered 3 letters, should 25% , , if 5 letters should 50% , on the simplest solution use textfielddidchangemethod . since uitextfielddelegate don't have that, can add behavior of uitextfield (or subclassed textfield matter) with: [yourtextfield addtarget:self action:@selector(textfielddidchange) forcontrolevents:uicontroleventeditingchanged]; and in target method: - (void) textfielddidchange { float txtprogress = yourtextfield.text.length / 10.0; [yourprogressview setprogress:txtprogress animated:yes]; } edit : can use uitextfieldtextdidchangenotification controlevent. both seem work fine.

c# - Silverlight 5 Get Usercontrol's handle -

i'm trying make pinvoke call register usb device connection notification. [dllimport("user32.dll", setlasterror = true)] protected static extern intptr registerdevicenotification(intptr hwnd, devicebroadcastinterface ointerface, uint nflags); [structlayout(layoutkind.sequential, charset = charset.unicode, pack = 1)] public class devicebroadcastinterface { public int size; public int devicetype; public int reserved; public guid classguid; [marshalas(unmanagedtype.byvaltstr, sizeconst = 256)] public string name; } a handle window, obtained onhandlecreated in winforms application required make such pinvoke calls. there way of obtaining handle of usercontrol in silverlight 5? silverlight, unlike wpf, not expose window handles. however, can, if try hard enough, find handle window. article describes method. call findwindow function hold of window handle. and remember won't handle user control because top level windows have handl

ios - Send Multiple Device Tokens to Parse through CURL -

i using parse send push notifications ios app users. works well, way have constructed leads page timeout when sending push many users. the code below in while loop sends data 1 device token @ time through curl. how reconstruct payload can push single json array contain of device tokens etc... ideas? my while loop: $target_device = $row['device_token']; $push_payload = json_encode(array( "where" => array( "devicetoken" => $target_device, ), "data" => array( "alert" => "$message" ) )); $rest = curl_init(); curl_setopt($rest,curlopt_url,$url); curl_setopt($rest,curlopt_port,443); curl_setopt($rest,curlopt_post,1); curl_setopt($rest,curlopt_postfields,$push_payload); curl_setopt($rest,curlopt_httpheader, array("x-parse-application-id: " . $appid, "x-parse-rest-api-key: " . $restkey, &quo

Android Moto X 4.2.2 Camera FaceDetectionListener onFaceDetection() never called -

i have app using api level 14 camera.facedetectionlistener in conjunction camera.startpreview(), camera.startfacedetection(), , camera.setfacedetectionlistener() after checking camera.parameters.getmaxnumdetectedfaces() . on moto x running 4.2.2, getmaxnumdetectedfaces() returns 5, onfacedetection() never called. testing on htc 1 running 4.4.2, works expected (and getmaxnumdetectedfaces() returns 16). are there other checks perform make sure face detection available on device? assistance.

android - How to draw on top on layout when calling camera -

Image
i have tried draw shape on layout use camera application. can draw rectangle , circle, need frame. provide me rectangle filled, not frame. have picture show below. , here code of layout. <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/linearlayout2" android:background="#ffffff" android:layout_width="wrap_content" android:layout_height="match_parent" > <relativelayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="0.91" > <framelayout android:id="@+id/cam_preview" android:layout_width="1120dp" android:layout_height="840dp" android:layout_weight="0.91" > </framelayout> <view android:layout_width="360dp" android:layout_height="525dp" android:layout

how to align fields in android? -

Image
hi making simple example in android problem textview , editfield not align.it mean should ![name editview rollnumber editview button on center][2] it this here code <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <linearlayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" > <textview android:id="@+id/text_view_boat1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="name" /> <edittext android:id="@+id/entry"

ibm mobilefirst - How to properly initialize the JSON store in Worklight 6.1 -

i attempting initalize ibm worklight json store below: //jsonstore jsonstorecollection metadata var jsonstorecollection = {}; //jsonstore jsonstorecollection metadata var collection_name = 'people'; function wlcommoninit(){ // create empty options pass // wl.jsonstore.init function var options = {}; //define collection , list search fields jsonstorecollection[collection_name] = { searchfields : {name: 'string'}, }; //initialize json store collection wl.jsonstore.init(jsonstorecollection, options) .then(function () { console.log("successfully initialized json store"); }) .fail(function (errorobject) { console.log("json store init failed :( "); }); } but when run in android emulator logcat gives me "json store init failed" message. , following error: [wl.jsonstore {"src":"initcollection", "err":-2,"msg":"provi

javascript - strange json_encode result returned in ajax callback -

Image
what did while ($obj = $post_items->fetch_object()) { echo json_encode($obj); } and console callback, seem working found data isn't correct. object have property post id , post_id, see below how can be?

Feed carbon/graphite from a remote host -

i have installed graphite on dedicated ubuntu server , correctly collects own system performance data e.g. cpu usage , load_avg , send carbon can see metric data on graphite web. the issue want send metric data multiple hosts carbon/graphite server. i used diamond send data server holding graphite/carbon , created naming scheme graphite can't see data on graphite-web. any additional requirements feed these data carbon , visualized graphite-web? here carbon listening on port 2003 interfaces lnxg33k@ubuntu:~$ sudo netstat -nltp | grep python tcp 0 0 0.0.0.0:2003 0.0.0.0:* listen 2114/python tcp 0 0 0.0.0.0:2004 0.0.0.0:* listen 2114/python tcp 0 0 0.0.0.0:7002 0.0.0.0:* listen 2114/python to test graphite-web/carbon configuration enough use bash commands, e.g.: echo "local.random.diceroll $(((random%6)+1)) `date +%

javascript - Why do we use the dollar window and document method for binding? -

this question has answer here: jquery , iife wrapper clarification? 1 answer why use this? (function( $, window, document, undefined ) { ....... })(( jquery, window, document );) i think $ converted jquery, ok! why window, document? and also, can use own selector method this? var mydiv = $('#mydiv'); (function( $, window, document, mydiv, undefined ) { ....... })(( jquery, window, document, mydiv );) to make locally scoped reference window , document. provides performance benefit.

symfony - Redirect url with .htaccess -

i m sure many people duplicated try other "question"`s , nothings work me. the problem move project web server. in server have folder "public_html" project symfony. enter on project must write following url: www.mydomain.com/symfony/web/* want write rewrite rule redirect www.mydomain.com/symfony/web/* www.mydomain.com/home/*. to try on 2 different ways many combination of rewrite rule. in public_html create .htaccess folder i edit .htaccess in symfony/web folder i add following rule in both file without success <ifmodule mod_rewrite.c> rewriteengine on rewritebase / rewriterule ^symfony/web/(.*)$ www.mydomain.com/home/$1 [l,r=301] unfortunately without success. i`m doing wrong? my htaccess file like and time error 404 object not found symfony/web/.htaccess directoryindex app.php <ifmodule mod_rewrite.c> rewriteengine on rewritebase /symfony/web/ rewritecond %{the_request} \s/+symfony/web/ [nc] rewriterule ^(.*)$ /home/$1

php - htaccess rewrite rule to include a string if it is not there -

how can update url htaccess file include string if not there. before site developed in drupal 6 , migrated drupal 7. mobile urls' got changed. example: http://m.example.com/en/terms-of-use http://m.example.com/en/m-terms-of-use http://m.example.com/en/contact-us http://m.example.com/en/m-contact-us google indexed previous url's , getting 404 errors. planned auto redirection htaccess. how can without inter-fairing main site ie. http://example.com you can use rule: rewritecond %{http_host} ^m\.example\.com$ [nc] rewriterule ^(en)/((?!m-).+)$ /$1/m-$2 [l,r=301,nc]

android - App crashes when calling native function encrypt hundred of times -

i have finished aes encryption wrapper written in c using openssl library. used wrapper in android project. when called encrypt function hundred of times encrypt lot of small files (images) caused crash error: 02-06 14:39:44.110: a/libc(5114): @@@ aborting: invalid heap address in dlfree 02-06 14:39:44.110: a/libc(5114): fatal signal 11 (sigsegv) @ 0xdeadbaad (code=1) this memory leak error can't figure out myself. guess went wrong in native code. below encrypt function written in c using openssl library. (compiled ndk) function init encrypt key int aes_init_encrypt(unsigned char *key_data, int key_data_len, unsigned char *salt, evp_cipher_ctx *e_ctx) { int i, nrounds = 4; unsigned char key[16], iv[16]; /* * gen key & iv aes 128 cbc mode. sha1 digest used hash supplied key material. * nrounds number of times hash material. more rounds more secure * slower. */ = evp_bytestokey(evp_aes_128_cbc(), evp_sha1(), salt, key_data, key_dat

javascript - SocketStream not executing anything from a newly added JS file in client -

i doing load js files in app folder ss.client.define('main', { view: 'app.jade', css: [ 'libs/reset.css', 'app.styl' ], code: [ 'libs/jquery-2.1.0.min.js', 'libs/angular-1.2.10.min.js', 'libs/lodash-2.4.1.min.js', 'app' ], tmpl: '*' }); there 3 files in app , 2 came default project , 1 added. first 2 work fine, 1 added not executed! the funny thing when there errors in file, set them in chrome console, no function gets executed or variable added page. any ideas why? it need access window variable/global-object. therefore need require entry file. typically means having lodash code file in actual code (/client/code/[...]) directory. i.e. wouldn't put in libs folder, in main app folder, although can make libs folder there. this i've had in order require --for example-- bootstrapjs. defies organisation of client side set up, it's way things

asp.net mvc - Where do you like to put MVC view model data transformation logic? -

here scenario, need load view model object several domain objects being returned multiple web service service calls. code transforms domain model objects digestible view model object bit of complex code. 3 places have thought putting are: internal methods inside of controller load instance view model. static method or property on view model class returns loaded instance of view model. an altogether separate builder or helper class has static method, property, or overloaded constructor returns loaded instance of view model. to clear, don't want use automapper, or tools it. best practices standpoint i'd know logic should go, , why. edit so here have far, give me "skinny" controller logic , separation of concerns. how can make better though? // ** controller ** public actionresult default() { var viewmodel = myviewmodelbuilder.buildviewmodel(markettype.spot); return view(spotviewurl, viewmodel); } // ** builder **

css - Unable to iterate thru list in autocomplete using up and down arrow key in dojo -

need help..unable iterate thru auto suggestions using , down arrow keys on keyboard here little code snippet dojo.require("dojo.nodelist-manipulate"); dojo.require("dojo.nodelist-traverse"); dojo.ready(function () { var div = dojo.query("#list-of-items"); console.log(dojo.byid("search").getboundingclientrect()); dojo.connect(dojo.byid("search"), "onkeyup", function (evt) { if (dojo.byid("search").value.trim() === "") { dojo.foreach(div.query("li"), function (elm, i) { dojo.style(elm, { "display": "block" }); }); dojo.style(dojo.query("#list-of-items")[0], { "display": "none" }); if(evt.keycode == 40){ return; }else if(evt.keycode == 38){

javascript - CSS - Hiding text that overlaps with textarea -

so have html code here, creates textarea , nice rectangle text 'html' @ top-right of textarea. fiddle . <div id="html_text"><h5 style=" margin-top: 17px; margin-left: 400px; position: fixed; color: black; z-index: 1; font-family: arial, helvetica, sans-serif; border-style: solid; border-width: thin; padding-left: 5px; padding-right: 5px; padding-top: 5px; padding-bottom: 3px; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;">html</h5></div> <textarea rows="20" style=" margin-left: 20px; font-family: 'courier new', courier, monospace; height: 280px; width: 460px; resize: none; overflow: scroll; overflow-x: hidden; position: absolute; z-index: 0;" id="html_code" spellcheck="false"></textarea> however, want make such when user has long string of text obstructs rectangle,

blogger - how to point my atulitbaldhamah.blogspot.in to subdomain blog.atulitbaldhama.com -

i have created blog on blogspot want when body open blog atulitbaldhamah.blogspot redirect subdomain blog.atulitbaldhama or body open blog.atulitbaldhama point atulitbaldhamah.blogspot , i read instruction change cname , tried fail i confused cname add in domain registrar panel or have create sub domain in hosting panel , add cname ? please me shailendra i got solution remember 1 thing can purchase domain registrar you can point blogspot blog using web hosting panel opening dns control panel of main domain add cname per blogger guide line on root not in subdomain, what made mistake : created sub domain on hosting panel no need create sub domain in hosting panel thank

visual studio - Shortcutting NuGet locally -

we have 2 visual studio solutions, f , c. f framework. c client uses dll:s produced f. we don't want create single solution containing both f , c. rather, want f produce nuget package consumed c. our current solution manually run script copies dll:s produced f specific folder in c. copied dll:s referenced files c. binary dll files checked in version control. not elegant, fast. copy takes fraction of second. our experience nuget becomes hindrance when doing development locally of both f , c. let's developer doing work on interface of f , how c uses it. developer has work in both f , c, switching , forth frequently. in scenario copying dll:s each time f updated fast. if introduce nuget, process considerably slowed down: each time f modified needs built on teamcity produce proper nuget package. c must nuget update on projects using nuget package new version. both waiting teamcity build , updating references slow. first takes mintues, second can take in order of minut

SQL Server Unique Index across tables -

it's possible create unique index across tables, using view , unique index. i have problem though. given 2 (or three) tables. company - id - name brand - id - companyid - name - code product - id - brandid - name - code i want ensure uniqueness combination of: company / brand.code and company / brand.product/code are unique. create view testview schemabinding select b.companyid, b.code dbo.brand b union select b.companyid, p.code dbo.product p inner join dbo.brand b on p.brandid = b.brandid the creation of view successful. create unique clustered index uix_uniqueprefixcode on testview(companyid, code) this fails because of union how can solve scenario? basically code both brand/product cannot duplicated within company. notes: error is: msg 10116, level 16, state 1, line 3 cannot create index on view 'xxxx.dbo.testview' because contains 1 or more union, intersect, or except operators. consider

jquery - How to append multiple lists in different pages into a single list? -

<!doctype html> <html> <head> <title>novar app</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css"> <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script> <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script> </head> <body> <body> <div data-role="page" id="home"> <div data-role="header"> <h1>site details</h1> </div> <div data-role="content"> <a href="#site entry1" data-role="button" data-inline="true">enter details of site</a> <a href="#modify site" data-role="button" data-inline="true">modify site de

dynamics crm - CRM 2013: Update a read-only field value using Business Rule -

i'm trying calculate date field value based on field, using business rule feature in crm 2013. field locked on form user cannot modify. think because of setting, field value bet set when click 'save' button value disappears. i believe same setsubmitmode("always") issue read-only fields. wondering if there way resolve issue inside business rule or form/field settings ? i'm having same problem found workaround: the workaround add locked field twice on form. make 1 instance of field 'read only' , 'visible' , make 2nd instance of field not 'read only' , not 'visible' on form. when business rules fire see 1 of instances of field not read , save database. source: https://social.microsoft.com/forums/en-us/741916de-e637-40f1-a675-944e7c0f5130/crm-2013-business-rules-updating-read-only-fields?forum=crm

eclipse - Failed to allocate memory: 8 android -

i have installed eclipse , android sdk manager, installed files android 4.22 in sdk , tried run sample android project.. getting following error [2014-02-06 15:28:08 - myfirstapp] android launch! [2014-02-06 15:28:08 - myfirstapp] adb running normally. [2014-02-06 15:28:08 - myfirstapp] performing com.example.myfirstapp.mainactivity activity launch [2014-02-06 15:28:08 - myfirstapp] automatic target mode: launching new emulator compatible avd 'avd_233' [2014-02-06 15:28:08 - myfirstapp] launching new emulator virtual device 'avd_233' [2014-02-06 15:28:17 - emulator] failed allocate memory: 8 [2014-02-06 15:28:17 - emulator] [2014-02-06 15:28:17 - emulator] application has requested runtime terminate in unusual way. [2014-02-06 15:28:17 - emulator] please contact application's support team more information. i tried following.. 1) accessed c:\users\user\.android\avd\user.avd\config.ini , changed hw.ramsize=1024mb 2)accessed avd , edited memory o

iis - Redirect all the requests to a another directory -

i'm using bellow web.config redirect requests folder. problem requests coming files want redirected. <?xml version="1.0" encoding="utf-8"?> <configuration> <system.webserver> <httpredirect enabled="true" destination="http://www.mysite.com/ppc/" /> </system.webserver> </configuration> example http://www.mysite.com/original/ http://www.mysite.com/ppc/ works but http://www.mysite.com/original/a.php http://www.mysite.com/ppc/ not works. it ended going http://www.mysite.com/ppc/a.php please help. try using iis url rewrite module rather issuing redirects or use url rewrite redirects on pattern matches.

c# - How do I determine if a date lies between current week dates? -

in c#, how check date in week dates? eg: 6/02/2014 current weeks: 02/02/2014 - 08/02/2014 so dates in above week.... use check (last parameter optional if want 1 week fromdate, don't need use last parameter): public static bool dateinside(datetime checkdate, datetime fromdate, datetime? lastdate = null) { datetime todate = lastdate != null ? lastdate.value : fromdate.adddays(6d); return checkdate >= fromdate && checkdate <= todate; } to call use: bool isdateinside = dateinside(new datetime(2014, 02, 06), new datetime(2014, 02, 02)); // return true and search first :) answer here: how check whether c# datetime within range if want check if dates inside same week , can use this: public static bool dateinsideoneweek(datetime checkdate, datetime referencedate) { // first day of week actual culture info, dayofweek firstweekday = system.globalization.cultureinfo.currentculture.datetimeformat.firstdayofweek;

Correct usage of bash getopts using long options -

i have written below code using long options getopts , doesn't work (arguments have no effect on values of variables). correct syntax? while getopts "c:(mode)d:(file1)e:(file2)" opt; case $opt in -c|--mode) mode=$optarg ;; -d|--file1) file1=$optarg ;; -e|--file2) file2=$optarg ;; esac done i found code in question ksh , not bash . getopts can't use long options. ended manually parsing arguments below while test -n "$1"; case "$1" in -c|--mode) mode=$2 shift 2 ;; -d|--file1) file1=$2 shift 2 ;; -e|--file2) file2=$2 shift 2 ;; esac done

Can't hide (minimize) window after setWindowFlags(Qt::FramelessWindowHint); -

operation system windows 7. use method window produce borderless window: setwindowflags(qt::framelesswindowhint); without flags may click on application icon on windows control panel , window appears, hides (minimizes) , etc. but after usage flag can't hide window clicking on application icon on control panel. how may combine flags window hides again?

Meteor custom domain with own certification -

when deploy app likes this: $ mrt deploy owndomain.com https://owndomain.com in web browser shows certification warning because certification's common name "*.meteor.com". is there anyway fix or replace certification own certification? you can't use own certificates meteor deploy hosting, @ least not yet. have wildcard ssl cert matches '*.meteor.com'. you need host able use own, or use .meteor.com domain. if dont have proxy supports websockets use: https://github.com/tarangp/meteor-ssl-proxy

ios - Do not Integrate TestFlight SDK in Release Builds using Cocoapods -

i integrated testflight sdk using cocoapods following podfile : https://gist.github.com/fabb/8841271 i not want testflight library linked in release builds (build config, not target). this article shows way remove libtestflight.a file release builds using excluded_source_file_names custom build setting. is there way can using cocoapods too? remember, cocoapods link libtestflight.a libpods.a , setting custom build setting in app target not help. an alternative idea include testflight sdk pod testflightrelease build config - seems not yet supported cocoapods. there suggested workaround while feature gets implemented: create new (empty) target of type "static library" named "debugtools" in user project link application, in debug, adding -ldebugtools other_ldflags build setting debug configuration (don't forget keep $(inherited) if not present already) then should able configure pods needed in debug ad