Posts

Showing posts from 2012

symfony - How can I access parameters defined in parameters.yml from within a twig template? -

i'm using symfony2. how can access parameters defined in parameters.yml within twig template ? thanks. define in config.yml this: twig: globals: some_key: %some_key% and use in twig files like: {{ some_key }} for security reasons can't access data parameters.yml in templates without defining global twig variables.

linux - How to calculate "Max Contiguous Free Space" that is available in a process? -

in 64 bit linux-rhel62 machine, calculate "max contiguous free space" available in process. seems details may calculated using /proc/self/maps. not know how use file calculate contiguous free space. any idea how ? i have followed perl script given in linux: how check largest contiguous address range available process but getting output "18446603339772190720" not acceptable value, (but understand somehow related 2^64). user not accepting value? correct , expected output? old code shows "physical memory + swap size" max contiguous free space. not convinced too, because getting same output every time. please let me know, why getting such impossible memory size free space? show me light, how find max contiguous free space available? that perl script looking at /proc/<pid>/maps if @ end of process map on red hat you'll see this: 7fff105a1000-7fff105a2000 r-xp 00000000 00:00 0 [vdso] ffffffffff600000...

How to create programmatically a spring PublishSubscribeChannel -

i want create programmatically following xml config <int:channel id="sample"> </int:channel> what can following publishsubscribechannel channel = new publishsubscribechannel(); but there no method assign id. actually <int:channel> produces directchannel bean. and if want programatically , have entire messaging infrastructure should configure bean anyway: @configuration public class myconfiguration { @bean public messagechannel sample() { return new directchannel(); } } the id attribute key feature of spring ioc container and, of course, isn't responcibility of concrete class. seems me should take new stuff of spring integration 4.0 .

Python array sum vs MATLAB -

i'm switching python , wanted make simple test comparing performance of simple array summation. generate random 1000x1000 array , add 1 each of values in array. here script in python : import time import numpy numpy.random import random def testaddone(data): """ test addone """ return data + 1 = 1000 data = random((i,i)) start = time.clock() x in xrange(1000): testaddone(data) stop = time.clock() print stop - start and function in matlab: function test %parameter declaration c=rand(1000); tic t = 1:1000 testaddone(c); end fprintf('structure: \n') toc end function testaddone(c) c = c + 1; end the python takes 2.77 - 2.79 seconds, same matlab function (i'm quite impressed numpy!). have change python script use multithreading? can't in matlab since don,t have toolbox. multi threading in python useful situations threads blocked, e.g. on getting input, not case here (see answers this que...

linux - How do I recursively visit and delete all files in a particular folder which has spaces in sh? -

i using p=` ls -l -p $mydir | egrep '^d' | awk '{print $9}' for getting folders , then for dirs in ${p} for recursively opening folders. works fine folder name without spaces, folder names spaces, second part of folder name selected seperate folder. to iterate on directories under $mydir , find "$mydir" -type d | while read dir; printf '%s\n' "deleting files in <$dir>" rm -f "$dir"/* done note must double quote dir variable when using prevent shell performing word-splitting @ spaces. skipping $mydir if don't need left exercise.

Android MedicCodec: How to record a video file from camera and stream the video to the web? -

i want build android application, record video camera, , @ same time, stream video web. i want build app based on example of cameracaptureactivity.java in grafika-master. have no idea plug in streaming function. i try looking @ videoencodercore.drainencoder() , bytes downstreamed muxer - mmuxer.writesampledata(mtrackindex, encodeddata, mbufferinfo); connection oriented streaming rtp/hls/mpeg-dash, etc have complete handshake phase in outer code, , push packets here. streaming examples available in libstreaming : https://github.com/fyhertz/libstreaming-examples

php - Mysql how to combine 2 update queries in 1 -

update `items` set `score`=[value-1],`up_votes`=[value-2],`down_votes`=[value-3] `id` = $id update `items` set `score`=[value-1],`up_votes`=[value-2],`down_votes`=[value-3] `id` = $id how can combine these 2 queries when ids needs dynamic? both coming table items . edit, score ( can + 10 or - 10) upvotes ( can +1 or -1) , downvotes ( can +1 or -1) so kind of dynamic, sorry misunderstanding try this, $idlist comma separated list, update `items` set `score`=[value-1],`up_votes`=[value-2],`down_votes`=[value-3] `id` in ($idlist)

Can I trust Perl to rename before I overwrite? -

can trust rename done before put new file in old location? if not better way this? (-e test.old) make sure it's been moved or unnecessary? rename("test", "test.old") || die "can't rename test"; open(file, ">test") || die "can't write test"; print file "foo"; close(file); there many things can make rename fail, addition of if (-e "test") { die "file not renamed beforehand!\n" } cheap insurance policy. in case, can not think of reason rename fail without triggering die condition have, if overwrite catastrophic disk read safeguard still worth it.

How to combine two differnt Image Sequences at different Frame Rates Into A Video with avconv & python? -

i have 2 sets of images have no problem combining separately avconv (with different rates using -r) 1 set @ -r .20 (extending 1 image 5 seconds of video ) , other set @ regular framerate assemble video @ regular speed. when try combine these seperate avi files avconv or avimerge resulting video has frame rate of first video (-r .20) is there way combine these 2 , both sequences in frame rates exported at? here sloppy code put here: try: p = subprocess.popen(["avconv" , "-y" , "-r" , ".20" , "-i" , "head%03d.jpg" , "-i" , audio , head_video_filename], universal_newlines=true, stdout=subprocess.pipe) out, err = p.communicate() retcode = p.wait() except ioerror: pass else: print "] encoding of header.avi finished:" + str(retcode) try: p = subprocess.popen(["avconv" , "-y" , "-i" , "tail%03d.jpg" , "-r" , "25"...

file - C++: Rename instead of Delete & Copy when using Sync -

currently have following part code in sync: ... int index = file.find(remotedir); if(index >= 0){ file.erase(index, remotedir.size()); file.insert(index, localdir); } ... // uses put command on file now want following instead: if file same before, except rename, don't use put command, use rename command instead tl;dr: there way check whether file same before except rename occurred? way compare both files (with different names) see if same? check md5sum, if different file modified. md5 check sum of renamed file remain same. change in content of file give different value.

insert - Hashtable in C: Does testing functions using manual arguments differ from user inputted arguments -

my problem rather odd one. when tested functions manually worked, returned random result when let user input arguments. to better explain myself, writing hash table using binary trees instead of linked lists (which part of assignment). is, in event of hash collision data chains binary search tree. i have finished of functions, in terms of testing, manually inputted arguments. set arguments inside tester rather having user type in when program runs. works fine , functions returns suppose return. however, when tried user input, insert , delete behaving strangely. instance, delete, supposed return value deleted. however, gave me value value of node in bst. manual input code snippet: inserted key = "111" , value = "d" manually char ** preval = calloc(1, sizeof(char *)); insertentry(*hthandle, "111", (void *) "d", (void **) preval); printf("existing value %s removed\n", *preval); free(preval); result: returned correct output,...

java - Jelastic Glassfish Mysql Character Setting -

Image
i have application running on jelastic. java based web application running on glassfish , database server mysql. i developed project on netbeans , there no character problem when running project on local machine (turkish windows 8). when running on jelastic, there no character problem related web pages. however, there problem when form based interactions called. some turkish characters not processed when search query or customer registration tasks executed. characters missing (recorded mysql ?)are ones differing latin. example "ö", used in german not problem. problematic characters: http://en.wikipedia.org/wiki/wikipedia:turkish_characters as said previously, dont have such problem when working on local glassfish rolled in netbeans. i checked out phpmyadmin server, , think values (that set default such latin1_swedish_ci) might cause loss of turkish characters. i tried change values on , reset defaults when server restarted. source of problem? if so, how set ...

angularjs - How apply animation transition on ng-view -

i'm trying apply transition in ng-view angular dart. html: <ng-view class="main-animation"></ng-view> css: .main-animation.ng-enter { -webkit-transition: 3000ms; -moz-transition: 3000ms; -ms-transition: 3000ms; -o-transition: 3000ms; transition: 3000ms; opacity: 0; } .main-animation.ng-enter.ng-enter-active { opacity: 1; } the animation doesn't work, ng-enter , ng-enter-active class not appear, , if simulate class putting. <ng-view class="main-animation ng-enter"><ngview> the content still rendering. ng-view in angular dart support animate?

how to create a GUI java for password and ID using array -

application ask user id , password , whether existing or new user. if new user prompted re-enter details confirm id , password , stored in array. once user clicks login button application search through array of ids , password verification. (set array contain maximum of 10 users – given small array can use linear search) application display appropriate message. my code far import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.*; public class log extends jframe { public static void main(string[] args) { log frametabel = new log(); } jlabel title = new jlabel("please type id , password"); jlabel id = new jlabel("id:"); jlabel psword = new jlabel("password:"); jbutton blogin = new jbutton("login"); jpanel panel = new jpanel(); jtextfield txuser = new jtextfield(15); jpasswordfield pass = new jpasswordfield(15); jradiobutton ra...

php - data not being updated -

data not being updated when trying update, showing not update data always, have session carrying reg registration table , want update reg in slam table in reg present. here reg present in both tables. <?php session_start(); if($_server["request_method"] == "post") { $con=mysqli_connect("xyz","aaa","aaa","aaa"); if (mysqli_connect_errno($con)) { echo "failed connect mysql: " . mysqli_connect_error(); } $reg = $_request["reg"]; $t1 = $_request["t"]; $t2 = $_request['t2']; $t3 = $_request['t3']; $t4 = $_request['t4']; $t5 = $_request['t5']; $t6 = $_request['t6']; $t7 = $_request['t7']; $t8 = $_request['t8']; $t9 = $_request['t9']; $t10 = $_request['t10']; $t11 = $_request['t11']; $t13 = $_request['t13']; $t14 = $_request['t14']; $t15 = $_request['t15']; $t16 = $_request['t16...

apache - WordPress blog on subdirectory .htaccess redirect -

i have joomla website on root-level, , wordpress blog on /blog . inside root-level .htaccess, need implement non-www www redirect, such as: rewritecond %{http_host} ^example.com$ rewriterule (.*) http://www.example.com/$1 [r=301,l] however, causes problem when going www.example.com/blog (withoug trailing "/" @ end). redirected http://www.example.com/cgi-bin/php53.cgi/blog/index.php the php53.cgi file there turn on php 5.3 version. content of file: #!/bin/sh export php_fcgi_children=3 exec /hsphere/shared/php53/bin/php-cgi this .htaccess inside /blog directory: # begin wordpress <ifmodule mod_rewrite.c> rewriteengine on rewritebase /blog/ rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /blog/index.php [l] # end wordpress you need redirect non- www www on both .htaccess since later .htaccess overwrite joomla .htaccess rules. rewritecond %{http_host} ^example.com$ [nc] r...

Asp.net c# Modify web config section value on button click -

i trying figure out 2 things (1) identify section in web config (2) change value on button click <location path="general" allowoverride="true"> <system.web> <authorization> <deny users="*" /> </authorization> </system.web> </location> i trying out figure out on btn click how change: <deny users="*" /> <deny users="?" /> also, if possible <deny users="?" /> becomes default unless changed again? this bad idea. not giving user of site write control of site's web.config file (a security risk), instant changes, appdomain recycle , terminate request (because web.config file changed).

C++ Long Division -

whilst working on personal project of mine, came across need divide 2 large arbitrary numbers (each number having 100 digits). wrote out basic code division (i.e., answer = a/b, , b imputed user)and discovered has precision of 16 digits! may obvious @ point im not coder! so searched internet , found code that, far can tell, uses traditional method of long division making string(but honest im not sure im quite confused it). upon running code gives out incorrect answers , wont work @ if a>b. im not sure if there's better way solve problem method in code below!? maybe there's simpler code?? so need write code, in c++, divide 2 large numbers. or suggestions appreciated! #include <iostream> #include <iomanip> #include <cmath> using namespace std; //avoids having use std:: cout/cin int main (int argc, char **argv) { string dividend, divisor, difference, a, b, s, tempstring = ""; // , b used store dividend , divisor. int quotien...

SQL SERVER 2008 R2 + Database In Recovery -

i store data web app in sql server 2008 r2. when connected ssms today database had (in recovery) in front of it. when ran query: select databasepropertyex('nydatabase', 'status') the status comes online . i confused should next. does mean recovery has happened successfully. if yes, why sql has in recovery in front of db still? with sql server express 2008r2, auto_close property set true default: setting database options true databases when using sql server 2000 desktop engine or sql server express, , false other editions, regardless of operating system. when set, property can cause behaviour you're seeing, i.e. ssms queries sql server metadata , @ particular instant database being opened. if set auto_close false , should disappear. you'll find few recommendations have set, anyway. can see through this link it's deprecated in 2008r2 it's odd it's still set default in circumstances. microsoft employee buck w...

javascript - duino bleep code not running -

i trying run following nodejs code, based on duino module found here: https://github.com/ecto/duino bleep.js: var arduino = require("duino"); var board = new arduino.board(); var led = new arduino.led({ board: board, pin: 13 }); var bleep = function() { led.on(); settimeout(function() { led.off(); }, 100); } setinterval( bleep, 1000 ); edit based on zmo's suggestion, running du.ino (found under duino/src/) on arduino board , bleep.js on laptop. whilst compiling bleep.js, following error: error: cannot open /dev/ i trying trace path being set. have traced error duino/node_modules/serialport/serialport.js may know how following line (found in serialport.js) works? function serialport(path, options, openimmediately, callback) { before function called on line 49, 'path' variable [object object]. after, becomes /dev/ where change take place? thank you. uhuh... start. it looks you're trying compile js code arduino...

big o - what the running time of this recursive algorithm? -

search_item(a,item,c) index <- c if (a[index] > item) index <- 2 * index search_item(a, item, index) else if (a[index] < item) index <- 2 * index + 1 search_item(a, item, index) else return index you gave little (no) information. sad, give answer , hope show more effort in other questions, show effort in answering question. the algorithm posted seems incomplete. think there return s missing. however: the simplest complexity analysis this: work on array a . let n number of elements in a . in every recursive call either multiplying current index 2 (and make recursive call) or return current index. assuming algorithm correct, can have k recursive calls 2 k < n . k < log₂(n) holds. this means algorithm has time-complexity of o(log n) . since algorithm named "search" algorithm, looks array a representation of binary search tree , search algorithm recursive binary search. fits complexity calculated. ...

python - How do I make the ball bounce off the paddle? -

i'm making basic pong game (paddle rectangle on bottom of screen , ball drops top of screen). want ball bounce when hits paddle. far, i've written code make ball bounce off top , bottom screen, i'm having trouble getting ball bounce off paddle. i have modify parameters passed test_collide_ball method. if it’s current x values within range of paddle, bounces up. i've been trying think of solution this, , i'm thinking if ball hits paddle's y coordinate (the height), bounces up. has within range of x coordinates make paddle (so width of paddle). but when this, ball gets stuck in place. feedback appreciated! in advance. here code ball class/methods: import pygame class ball: def __init__(self, x, y, radius, color, dx, dy): self.x = x self.y = y self.radius = radius self.color = color self.dx = dx self.dy = dy def draw_ball(self, screen): pygame.draw.ellipse(screen, self.color, pygame.rect(self....

OpenWrt (Linino) + uHTTPd + PHP 5.4 - how to add Phar and Filter module to PHP -

i struggling adding phar , filter module php , under uhttpd server on openwrt (linino) . can ask advice? my system settings: linux arduino 3.8.3 php version 5.4.17 i able install other modules curl , running opkg command opkg install php5-mod-curl but when trying same phar or filter there's no luck, these packages don't exist. root@arduino:~# opkg install php5-mod-phar unknown package 'php5-mod-phar'. do need rebuild php include them (if so, how?) or there simpler way of doing this? can me , point me right direction? also, part of output phpinfo() configure command './configure' '--target=mips-openwrt-linux' '--host=mips-openwrt-linux' '--build=x86_64-linux-gnu' '--program-prefix=' '--program-suffix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--libexecdir=/usr/lib' '--sysconfdir=/etc' '--datadir=/usr/share...

algorithm - Finding the Number of Positions to Satisfy a Configuration -

you want party complete laser light show. unfortunately, working laser have found located far away house , heavy move, want re-direct laser light house using series of mirrors. the layout of grid has laser @ position (0,0) pointing north (in positive y direction), , house @ (hx, hy); can think of both laser , house points in 2d plane. there n mirrors (1 <= n <= 100,000) scattered throughout grids aligned @ angles of 45 degrees axes. example, mirror aligned \ take beam of light entering below , reflect left. can think of mirrors being located @ points in 2d plane. after setting configuration, notice major flaw in plan: laser cannot hit house mirrors in current configuration! result, plan run out onto field, , hold 1 more mirror (placed once again @ 45 degree angle) in order redirect laser onto house. please count number of locations in field can stand accomplish goal. all coordinates integers between -1,000,000,000 , 1,000,000,000. guaranteed mirrors placed in range...

javascript - Adding multiple parameters to an else if statement? -

let me explain in more detail, i'm making little sketch maths teacher calculate missing sides , angles of triangle. have if/else/else if statements want else if statement output "check spelling" if none of other statements true. basically, want something (keep in mind don't know how program yet) // more code above else if (side != "hypotenuse , adjacent"; "hypotenuse , opposite"; "opposite , adjacent") { confirm("please check spelling."); } can see trying do? previous variable called side , prompts user input sides of triangle have, sketch can work out angle. if have spelling mistake , doesn't match of parameters set, how make follow out block of code if don't match? may have over-complicated things here if tell me how this, appreciated you can try indexof : possibilities = ["hypotenuse , adjacent", "hypotenuse , opposite", "opposite , adjacent"] // if side not in a...

Why can rails not find a route created by a helper? -

i created member route in rails 4: resources :line_items post 'decrement', on: :member end and gave matching method in line_items controller: def decrement @cart = current_cart @line_item = @cart.line_items.find_by_id(params[:id]) @line_item.decrement_quantity respond_to |format| if @line_item.save format.html { redirect_to shop_path, notice: 'line item updated.' } format.js {@current_item = @line_item} format.json { head :ok } else format.html { render action: "edit" } format.js {@current_item = @line_item} format.json { render json: @line_item.errors, status: :unprocessable_entity } end end end but when try make button: <%= button_to 'x', decrement_line_item_path(item) %> i error: no route matches [post] "/carts/25" what gives? your error message is: no route matches [post] "/carts/25" but expectin...

Why can't I click a Button in a ListView using SimpleAdapter in android? -

Image
i newbie android. have posted question earlier didn't find appropriate answer. requirement make button clickable in listview which generated using simpleadapter .i don't want use customadapter , baseadapter or other adapter. don't want extend activty simpleadapter .my code , error logs follows. if has solutions please explain me step step. thank you. mainactivity.java public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); arraylist<hashmap<string, string>>val1=new arraylist<hashmap<string,string>>(); hashmap<string, string>val=new hashmap<string,string>(); val.put("a","a"); val.put("c","c"); val.put("b","b"); val1.add(val); final listview l=(listview)findviewbyid(r.id.listview1); listadapter k=new ...

android - Google Places API returning provided API key is invalid -

Image
read thru posts on subject , tried out combination : 1. used android key while making google places api call ( 2. switched browser key 3. later tried server key. 4. re-generated keys , tried combination 1-3. nothing working !!. key mapv2 api in manifest file android key. app working correctly until created new project , listed package new project. recreated new android key package. old key still there different project. have not deleted old project removed key under it. have new keys android, browser under new project. doing wrong?. i error message " provided api key invalid"... when make call browser using browser key working . not not android app . tips ?. please see code below:- final string places_api_base = "https://maps.googleapis.com/maps/api/place/nearbysearch"; final string out_json = "/json"; final string key=<browser-key> final string sensor="false"; stringbuilder querystring = new stringbuilder(places_api_base+o...

objective c - Replace both SplitView screens with one ViewController screen -

i can't seem find navigation use case ipad splitviewcontroller. using storyboard, have created splitviewcontroller shows master/detail , works great. detail view, want have button replaces entire splitviewcontroller (both master , detail screens) single viewcontroller. ideally, navigation allow button function return splitviewcontroller i'm open other solutions long viewcontroller using full screen (i need every piece of screen real estate possible - , have popovers if of consequence solution). i assume possible , sure i'm not first needs i've searched quite bit , found similar use cases, not exact. here's current layout in storyboard: tabbarview splitview navigation master navigation > tableview detail splitview b navigation master navigation > tableview detail full screen viewcontroller (where go in above structure?) so need splitview b navigate full screen viewcontroller not yet integrated screen navigation tree because d...

jsf - Parameters set to null on call to function -

i have table fields. problem player , serietype set null when pressing save button. selectonemenu items correctly set when using them. it's when press button set null. <p:datatable id="scores" var="ascore" value="#{servicescoredb.scoreslist }" border="1"> <p:column id="playername"> <f:facet name="header">namn</f:facet> <p:commandlink value="#{ascore.playername}"> </p:commandlink> </p:column> <p:column id="player"> <f:facet name="header">spelare</f:facet> spelare <p:selectonemenu value="#{player}" converter="playerconverter" id="playerlist"> <f:selectitem itemlabel="---" noselectionoption="true" /> <f:selectitems value...

Kendo Upload upgrade(MVC) - OnUploadSelect code change -

with older version of telerik, had snippet of code find number of childnodes given below function onuploadselect(ev) { var numberoffiles; if (ev.target.childnodes[1] != undefined && ev.target.childnodes[1] != null) { numberoffiles = ev.target.childnodes[1].childnodes.length; } if ((numberoffiles + ev.files.length) > 4) { //some custom validation error msgs being thrown } } the basic logic of code prevent uploading more 4 files, ex - select 2 files,dont click on upload instead select file again , click on upload, i'm good(2+1<4) kendo uplaod, ev.target undefined, can suggest possible alternative this? thanks adarsh please try below code snippet. kendo-html <!doctype html> <html> <head> <title>test</title> <link href="http://cdn.kendostatic.com/2014.1.318/styles/kendo.common.min.css" rel="stylesheet" /> <link href="http://cdn.kendostatic.com/2014.1.318/styles/kendo.default.min...

python - Parsing string containing possibly two json objects -

this question has answer here: parse json in python 4 answers how differentiate , parse data strings json objects: "[{"months": 12, "product": "car"}, {"months": "12", "product": "bike"}]" "[{"months": 12, "product": "car"}]" i need know count of json objects in string , values based on that use json module json_string = '[{"product": "car", "months": 12}, {"product": "bike", "months": "12"}]' import json data = json.loads(json_string) print data[0], len(data)

c# - Google authentication in portable class library -

i write portable application (windows store, windows phone, windows). use portable class library. see google make tasks api library (windows store, windows phone, windows). have problem google auth. this code not work in portable library, (it's works on windows phone): private observablecollection<string> _tasklisttitlescollection = new observablecollection<string>(); public observablecollection<string> tasklisttitlescollection { { return _tasklisttitlescollection; } set { _tasklisttitlescollection = value; } } public async void myfuncrion() { usercredential credential = await googlewebauthorizationbroker.authorizeasync( //new filestream("client_secrets.json", filemode.open, fileaccess.read), new clientsecrets { clientid = "", //"put_client_id_here", clientsecret = "" //"put_client_secrets_he...

objective c - iOS - Downloading images asynchronously and using them alongside Core Data -

in core data model have entity keeps urls of images. want download these images can use them in uicollectionview model, array of core data entities. want able access these images synchronously (assuming have been downloaded async) there's no delay between them loading in respective cell. currently, using async method in cellforindexpath: data source delegate method of uicollectionview when collection view reloaded, if there images still being downloaded, assigned wrong cell cells have been inserted during time. this problem seems should obvious solve cannot work out. any ideas appreciated. thanks. you can download images asynchronously in viewdidload , , add them nsmutablearray follows dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^{ (int = 0; < carphotos.count; i++) { nsurl *photourl = [nsurl urlwithstring:carphotos[i]]; nsdata *photodata = [nsdata datawithcontentsofurl:photourl]; ...

c# - creating a new dictionary out of 2 matching ones -

labelmap = new dictionary<string, int>(); branchlinemap = new dictionary<string, int>(); if 1 key of first dictionary matches key of other dictionary need make new dictionary value of branchlinemap become key , value of labelmap become value. how do while iterating on whole dictionary? using where , todictionary methods, can this: var newdictionary = labelmap .where(x => branchlinemap.containskey(x.key)) .todictionary(x => branchlinemap[x.key], x => x.value);

ios - Why is [NSNull null] value not added to NSDictionary? -

i creating nsdictionary using code below, , expecting have key @"originalmessageid" contain [nsnull null] when originalmessageid.intvalue == -1. but logger writetologfile method gives following output: 2014-04-07 19:16:52: json params: { addressid = 1; } i've stripped code down trying add 2 keys, , still it's not adding originalmessageid key. where going wrong? p.s. code fails when load app distribution build, seems work when load app development build. nsdictionary *jsondict; sourcephonenumber *sourcephonenumber = [databaseinterface fetchdefaultsourcenumber]; [logger writetologfile:[nsstring stringwithformat:@"sourcephonenumber = %@", sourcephonenumber]]; if (originalmessageid.intvalue == -1) { //nsstring *uuidstring = [[nsuuid uuid] uuidstring]; jsondict = [[nsdictionary alloc] initwithobjectsandkeys: [nsnumber numberwithunsignedlonglong:1], @"addressid", /* should sourcephonenumber.addressid */ ...

php - WP: inline styling background image - not working Safari 6.0 and under -

i getting post/page featured image inline background image. the code below works on of browsers, not on safari 6.0 , under. on safari 6.0 inline style skips background:url('xxx') no-repeat scroll xxx xxx / cover; , goes directly min-height:(...) . the background-attachment not showing in dom. example of single project site: http://skarpsinn.no/prosjekter/oeva . try ex. chrome , safari 6.0. php-code single pages - pretty same on other pages. <?php if(is_single()): $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->id ), 'single-post-thumbnail' ); ?> <?php if ( has_post_thumbnail() ) { ?> <div class="featured_image" style="background: url('<?php echo $image[0]; ?>') no-repeat scroll <?php the_field('bg_vert_posisjon'); ?> <?php the_field('bg_hor_posisjon'); ?> / cover; min-height: 700px;...

php - Not getting the response -

i creating application in send parameters web service right running on local host , gives me json response. somehow not working after line httpresponse httpresponse = httpclient.execute(httppost); . can please. ps. webservice working absolutely fine test_class.java package com.vitarkasolutions.tracker; import java.io.ioexception; import java.io.inputstream; import java.io.inputstreamreader; import java.io.reader; import java.io.unsupportedencodingexception; import java.util.arraylist; import java.util.list; import org.apache.http.httpentity; import org.apache.http.httpresponse; import org.apache.http.httpstatus; import org.apache.http.namevaluepair; import org.apache.http.client.clientprotocolexception; import org.apache.http.client.entity.urlencodedformentity; import org.apache.http.client.methods.httppost; import org.apache.http.impl.client.defaulthttpclient; import org.apache.http.message.basicnamevaluepair; import android.app.activity; import android.os.asynctask; imp...