Posts

Showing posts from April, 2012

IcCube - excluding members on schema level -

edit (copy&paste errors): i use time wizard dimension , having dates being not in future. since have set end date, obviusly not change every day hand, set high , remove afterwards members lying in future. tried use "advanced" methods "scripts" , "perspectives". prefer first, since make members vanish , not being invisible, if there no way of doing so, second ok well. if filter dates in mdx statement, works fine: filter([date].[date].[day].members, [date].currentmember.key < now()) using script tried drop members: drop member filter([date].[date].[date].members, [date].[date].currentmember.key > now()) and gave me syntax error: syntax error: unexpected statement '(' (open_paren) trying use perspective -filter([date].[date].[day].members, [date].currentmember.key > now()) told me: syntax error: unknown function/property 'key' what have do, rid of dates? while loading schema @ latest.

Symfony - Security / routing setup to enable password protected user pages -

i'm pretty new symfony although i've managed set working site, role based authentication , firewalls i'm struggling working out how build system allows users login , have access page , admin has access to. what want dynamic security role enables user in current session access own private page , blocks else... here's actual config: security: encoders: #define encoders used encode passwords symfony\component\security\core\user\user: plaintext intuitbydesign\userbundle\entity\user: bcrypt role_hierarchy: role_admin: [role_user] providers: chain_provider: chain: providers: [in_memory, user_db] in_memory: memory: users: admin: { password: adminpass, roles: role_admin } user_db: entity: {class: intuitbydesignuserbundle:user, property: username } firewalls: main: logout: true

android - How to Logout facebook button completely include (change text 'log out' to 'log in with facebook' ) from another activity -

i trying logout fb button activity problem when logout activity.facebook button show logout text , not logout means again click on logout logout fb button. try if (accesstoken.getcurrentaccesstoken() == null) { return; // logged out }else { new graphrequest(accesstoken.getcurrentaccesstoken(), "/me/permissions/", null, httpmethod.delete, new graphrequest .callback() { @override public void oncompleted(graphresponse graphresponse) { loginmanager.getinstance().logout(); } }).executeasync(); }

How to resend post multipart/form-data form with upload file to different server with Java Spring -

i receiving multipart file via http post in java spring. want forward request file other server. how can in spring java? in jsp file: <form ... method="post" enctype="multipart/form-data"> and in controller class: @requestmapping(value = "/save", method = requestmethod.post) @responsebody public long save(@requestparam("file") multipartfile file, @requestparam string filecode,...) throws ioexception { ... }

html5 - How to count the lines of a <pre> poem using css? -

i want display beowulf on webpage, full poem. code far: <head> <title>beowulf</title> <style type="text/css"> body {padding: 10% 25%;} pre {font-family: "times new roman"; font-size: 100%;} </style> </head> <body> <h3>beowulf</h3><br> <pre>now beowulf bode in burg of scyldings, leader beloved, , long ruled in fame folk, since father had gone (...) of furious flame. nor far day when father , son-in-law stood in feud warfare , hatred woke again. (...)</pre> </body> now how every fifth line numbered? position numbers on extreme edge of right side. i appretiate if tried explain issue me didatically possible. friend of simplicity , give preference codes shouldn't bigger beowulf poem (if message!), preferably css. if javascrpit way there, kindly ask formulate answer in didactical way can. programming skills "lower-intermediate" , unfortunately didn

sql server - SQL: How to Pivot a Table with Pivot Columns Sharing the Same Name? -

this question has answer here: sql pivot table dynamic 2 answers i using sql server 2008 r2 version 10.50.1600.1. i'm trying pivot table strings pivot column shares same name. data looks like. +------------+-----------+------------+ | patient_id | code_type | code_value | +------------+-----------+------------+ | 1 | icd9 | v70 | | 1 | icd9 | 401.9 | | 1 | icd9 | 616 | | 1 | icd9 | 338.21 | | 2 | icd9 | v10 | | 2 | icd9 | 250 | +------------+-----------+------------+ what i'm trying ... +------------+--------+--------+--------+--------+--------+--------+ | patient_id | icd9_1 | icd9_2 | icd9_3 | icd9_4 | icd9_5 | icd9_x | +------------+--------+--------+--------+--------+--------+--------+ | 1 | v70 | 401.9 | 616

php - Dividing up multiword $_POST input -

i trying have php form takes in text input, queries underlying mysql table. <form method="get" action="search.php" name ="searchbar"> <input type="text" name"search"> <input type="submit" value="search"> </form> the schemas of tables querying movie(id, title, year, rating, company) actor(id, last, first, sex, dob, dod) for movie, think it'll easy because make query where title '%".$_post['search']."%' along line. actor, since name divided 2 parts (last, first), think need break down inputs words can compare each word attributes. (so if input 'hanks tom' or 'tom hanks', query able find actor tom hanks either input) there way achieve this, or possibly smarter way approach this? you have search every combination of input see if 1 of them match first or last name. keep in mind first , last reserved word

Powershell: add child node in XML -

i have following xml tree: <company> <employees> <employee name="dwight" id="e1000" department="sales"> </employee> <employee name="toby" id="e1001" department="hr"> </employee> <employee name="jim" id="e1002" department="sales"> </employee> <employee name="pam" id="e1003" department="reception"> </employee> </employees> </company> i add child named "address" under each employee , under "address", add different children named "housenumber", "street" , "zip" this i've tried far, add "address" child: $filename = "c:\code\employees.xml"; $xmldoc = [system.xml.xmldocument](get-content $filename); $newxmlemployee = $xmldoc.company.employees.employee.appendchild($xmldoc.createelemen

bash - Shell output to text file -

so, have following shell: #!/bin/bash (( = 1; <= 6; i++ )) printf in_port=$i,actions= (( j = 1 ; j <= 6; j++ )) if [ $i != $j ]; printf output:$j, fi done printf "\n" done which, produces following output: home@mininet:~$ ./hostsscript.sh in_port=1,actions=output:2,output:3,output:4,output:5,output:6, in_port=2,actions=output:1,output:3,output:4,output:5,output:6, in_port=3,actions=output:1,output:2,output:4,output:5,output:6, in_port=4,actions=output:1,output:2,output:3,output:5,output:6, in_port=5,actions=output:1,output:2,output:3,output:4,output:6, in_port=6,actions=output:1,output:2,output:3,output:4,output:5, how go appending each line of output txt file, line-by-line? option 1 inside script: #!/bin/bash (( = 1; <= 6; i++ )) printf in_port=$i,actions= (( j = 1 ; j <= 6; j++ )) if [ $i != $j ]; printf output:$j, fi done printf

java - Selenium - How to count the number of rows in a table dynamically? -

in html page there's table 10 rows; rows display based on filter (dynamically). let's say, example, without filters default 10 row returned. after applying filter, less 10 rows returned, depending on type of filter, want dynamic count of table rows (after filter) using selenium web driver. i tried driver.findelements(by.xpath("abcd")).size() giving default count 10; however, after applying filter 2 rows appearing. please suggest how dynamic count (count=2 appearing 2 rows in ui) . to find total number of elements on dynamic webpage need use driver.findelements().size() method. it's not useful @ all. first size of element matching row count. once have can use dynamic xpath ie replace row , column number run time data. { list<webelement> rows_table = mytable.findelements(by.tagname("tr")); //to calculate no of rows in table. int rows_count = rows_table.size(); //loop execute till last row of table. (int row=

Zookeeper behind AWS ELB with Mesos -

has managed mesos talk zookeeper through aws elb. my initial experiment has been no. i have zookeeper on asg netflix exhibitor. thing bugs me when zk instances replaced, have reconfigure servers in mesos cluster. not difficult, rolling restart along annoying enough. i set route53 internal vpc dns uses elb. setting cname of zk.internal.com:2181 zk instance seem work far. aren't running in production yet though, don't know kind of problems arise then.

angularjs - How to change order of the menu items of the modules into mean.io? -

i had added each module of application menu of mean.io, of app.js file this: theme.menus.add({ title: 'theme example page', link: 'theme example page', roles: ['authenticated'], menu: 'main' }); all modules shown in menu, order wrong, how can change order? you need specify order of menu adding. for example: function menuconfig(menus) { menus.addmenuitem('topbar', { title: 'cuentas', state: 'accounts', type: 'dropdown', roles: ['*'], position: 1 }); } you need use attribute >> position. position (optional; default: 0) - specify order of appearance.

Java : string.replace(oldChar , newChar) ignoring another command -

so beginner in programming , working in eclipse. trying word lower case , delete spaces if there can later check if word palindrome or not. when enter word.replace ignores tolowercase command , deletes spaces. scanner scan = new scanner(system.in); system.out.print("enter word transform: "); string word = scan.nextline(); string newword = word.tolowercase(); newword = word.replace(" " , ""); system.out.println(newword); so code if enter "an a" get ana but should : ana and reason happens in eclipse whereas in netbeans works normally. suggestions ? replace newword = word.replace(" " , ""); newword = newword.replace(" " , "");

java - Difference between int[] array and int array[] -

i have been thinking difference between 2 ways of defining array: int[] array int array[] is there difference? they semantically identical. int array[] syntax added c programmers used java. int[] array preferable, , less confusing.

xdebug - What are the settings in PHP.ini file to start xdebugger? -

i have below settings in php.ini file xdebug. [xdebug] ;; zend or (!) xdebug zend_extension_ts ="c:\xampp\php\ext\php_xdebug.dll" xdebug.remote_enable=true xdebug.remote_host=127.0.0.1 xdebug.remote_port=9001 xdebug.remote_handler=dbgp xdebug.profiler_enable=1 xdebug.profiler_output_dir="c:\xampp\tmp" you need send cookie called xdebug_profile server. can use browser plugins easy xdebug (firefox) or xdebug helper (chrome) . if want keep debugger active, can add line php.ini : xdebug.remote_autostart = 1 https://xdebug.org/docs/remote

How to load a file into a html5 audio tag -

how load audio file <input type="file"> tag audio tag? have tried : <input type="file" id="file"></input> <script> var file = document.getelementbyid("file"); var audio = document.createelement("audio"); audio.src = file.value; document.write(audio) </script> i believe satisfy needs. first, file input needs bound via javascript or jquery (if prefer). can use blob browser support the following basic example; <input type="file" id="file"></input> <audio id="audio" controls autoplay></audio> we bind #file changes using addeventlistener below // check bloburl support var blob = window.url || window.webkiturl; if (!blob) { console.log('your browser not support blob urls :('); return; } document.getelementbyid('file').addeventlistener('change', function(event){ cons

javascript - HTML page not displaying the image -

i have following javascript file: var canvas = document.getelementbyid('canvas'), context = canvas.getcontext('2d'), image = new image(); image.src = 'abc.jpg'; image.onload = function(){ var cols = image.width; var rows = image.width; canvas.width = cols; canvas.height = rows; context.drawimage(image, 0, 0, image.width, image.height); }; the html file looks follows: <html> <head> <title>chapter1</title> <script src="matrix.js"> </script> </head> <body> <canvas id="canvas"></canvas> </body> </html> but, when try view html page, don't see image, provided files including image in same directory. what doing wrong? thanks.

html - Grab Selected Data using Select Box with PHP accessing a MySql database -

how grab selected data select box database? i've succeeded in doing radio button, when grabing select box stuck. the theory is, if data in database saved 2007-2009 value in th_arsip field, show again selected data (2007-2009) , show options when want update data update form. here's code: <?php require "config.php"; $id_arsip = mysqli_real_escape_string($conn,$_get['id_arsip']); $sql = "select * arsip id_arsip = '$id_arsip' "; $result = mysqli_query($conn, $sql); $data = mysqli_fetch_array($result); ?> <div class="col-xs-4"><label>year</label> <select name="th_arsip" id="th_arsip" class="form-control" required> <?php echo "<option value='2004-2006' ".($data['th_arsip'] == "2004-2006"?'checked':'')."> 2004-2006 </option> ". "<option value='2007-2009' ".($da

physical deployment of asp.net web applications vs web sites in shared hosting -

update below i'm used asp.net web sites, not web applications, , i've deployed ftp'ing asp.net web site folder folder on shared hosting service have pre-defined domain name/web-site (or, wiring web site iis on vps). deploying web applications appears different, , i'm not connecting dots. msdn here says: deployment for web applications copy assembly server. assembly produced compiling application. .... for web sites copy application source files computer has iis installed on it. ... "you copy assembly server." gather further reading deployment assembly kind of executable execute on server, , automagically hooks web app iis , other things. i'm not seeing how that's going work shared hosted web site environment, can't control server execute deployment package. which mean can't deploy asp.net web application shared hosted service (at example azure or arvixe); i'd have vps or dedicated server them, , use remote desktop

hadoop - How can I import the distcp package in java? -

how can import distcp package in java ? tried "org.apache.hadoop" % "hadoop-distcp" % "2.7.1" dependency , used import statement follows import org.apache.hadoop.tools.util.distcp but distcp not recognized. i trying call distcp in java hadoop code using tool runner import doesn't work. thank you the simple thing have note down here is, package org.apache.hadoop.tools.util doesn't contains distcp class. rather that, package org.apache.hadoop.tools contains distcp class. to fix issue, import follows : import org.apache.hadoop.tools.distcp; which recognized ide, believe. for reference, refer link .

Removing the validation on onepage checkout in Magento -

on magento website have series of customers have no first name / last name in shipping address it's not needed. when try checkout on onepage checkout without firstname/lastname following error: "please check shipping address information. please enter first name. please enter last name." is there anyway , disable validation these 2 fields stop error appearing? note: excluding first / last name attributes not recommended within magento dependent on these attributes within archetecture. if know you're doing , have taken backup of database, try following: first, need remove required-entry class on fields within template. backend still validate first / last name data still exists. secondly, can remove requirement first / last name entry modifying eav_attribute table. find rows rows attribute_code being "firstname" , "lastname" , entity_type_id being "2" (which id of address model attributes). change is_required value

xcode - Storyboards load VERY slowly (20-30 minutes) for all tvos projects - Any suggestions -

i had hard crash of xcode 7.1 (ga) yesterday while working on tvos project. since then, taking 20-30 minutes tvos storyboard load -- regardless of tvos project i'm working on (including new tvos projects create) i've uninstalled xcode 7.1 , reinstalled, issue persists. any ideas on how fix and/or work-around issue? suspect when uninstalled xcode 7.1 , reinstalled, there's residual files somewhere need cleaned out before install. problem on 1 machine, other instances on other mac's working (reasonably) okay. one added piece of information: when storyboard on new project loads, default dark gray gradient within initial view controller gone. it's white.

java - ViewPager not responding quickly -

while using viewpager noticed wouldn't respond quickly, meaning slows down when switchting through fragments, kind of in laggy way. does know how code causing issue? public class list_adapter : baseadapter<element> { public list<element> _list; fragmentone _context; public list_adapter(fragmentone context, list<element> list) { super(context, list); _list = list; _context = context; } @override public int getcount() { return _list.size(); } @override public object getitem(int position) { return _list.get(position); } @override public long getitemid(int position) { return getitem(position).hashcode(); } @override public view getview(int position, view convertview, viewgroup parent) { layoutinflater inflater = (layoutinflater)getactivity().getapplicatio

In R Regex that ignores some punctuation at the end of a URL string -

is possible use regex function ignores punctuation (not " / 's") @ end of url strings (i.e. punctuation @ end of url string followed space) when extracted? when extracting urls, i'm getting periods, parenthesizes, question marks , exclamation points @ end of strings extract example: findurl <- function(x){ m <- gregexpr("http[^[:space:]]+", x, perl=true) w <- unlist(regmatches(x,m)) op <- paste(w,collapse=" ") return(op) } x <- "find out more @ http://bit.ly/ss/vuer). check out here http://bit.ly/14pwinr)? http://bit.ly/108vjom! now!" findurl(x) [1] http://bit.ly/ss/vuer).http://bit.ly/14pwinr)? http://bit.ly/108vjom! and findurl2 <- function(x){ m <- gregexpr("www[^[:space:]]+", x, perl=true) w <- unlist(regmatches(x,m)) op <- paste(w,collapse=" ") return(op) } y <- "this www.example.com/store/locator. of type of www.example.com/google/voice. data i&#

ruby - Celluloid SupervisionGroup does not work -

i write following script in order understand celluloid. require 'celluloid/current' class processor include celluloid def perfom(number) puts "#{number} ... (#{thread.current}) ..." sleep(number%3) puts "launch finish!" return number end end pool = processor.pool(size: 3) futures = (1..7).map |i| pool.future(:perfom, i) end puts futures.map(&:value) pool.terminate all work fine , want avoid call terminate on pool. so try use supervisor raise me uninitialized constant celluloid::supervisiongroup after search find (in deprecated folder) : ( https://github.com/celluloid/celluloid-supervision/blob/master/spec/celluloid/deprecate/supervision/supervision_group_spec.rb ) i wanted make work : supervisor = celluloid::supervisiongroup.run! pool = supervisor.pool(processor, size: 3, as: :worker) futures = (1..7).map |i| pool[:worker].future(:perfom, i) end puts futures.map(&:value) how can make work future

powershell - How to verify successful installation of SQL Server 2008 R2 -

i'm trying install sql server 2008 r2 silently using powershell script. after installation need verify installation successful. there way check exit code in sqlsetup.log file successful installation? following code, i'm using:- # read current directory $scriptpath = $myinvocation.mycommand.path $parentdir = split-path $scriptpath #read config file current directory $configfile = $parentdir + '\configurationfile.ini' write-host $configfile #holds base setup current directory $setupfile=$parentdir + '\setup.exe' write-host $setupfile $sp3setupfile=$parentdir + '\sqlserver2008r2_sp3\setup.exe' write-host $sp3setupfile #start of log file $start="========================================================================================" $start | out-file $env:temp\installsql2008r2_log.txt -append #printsd current date , time in log file $date=get-date $date | out-file $env:temp\installsql2008r2_log.txt -append #starting sql base installat

css - Javascript If/else style changing -

i have problem simple if else statement changes text color of <p> element depending on current color. see why results can't seem find solution. newbie me appreciated. html <p id="demo">javascript can change style of html element.</p> js try 1 <script> var x = document.getelementbyid("demo"); function one() { x.style.fontsize="16px"; x.style.color="black";} function two() { x.style.fontsize="16px"; x.style.color="red";} function three(){ if(x.style.color="black") { two() } else {one() } } </script>` <button type="button" onclick="three()">click me!</button> js try 2 <script> var brojilo = 1 ; function three(){ var x = document.getelementbyid("demo"); function two() { x.style.fontsize="18px"; x.style.color="red";} function one() { x.style.fontsize="18px"; x.style.color=&

ios - What can limit device other than UIRequiredDeviceCapabilities? -

i found out app on testflight compatible ipad air , mini, , not ipad 4th gen. i'm trying figure out why is. in project's info.plist, device requirement have armv7, compatible recent ipad models. else should check figure out why ipad 4th gens , below aren't compatible?

Python key on press -

i have opening animation in program runs every time when program executed. has 5 frames, each frame separated from time import sleep import os print("frame 1") sleep(2) os.system('cls') print("frame 2") i know possible in tk() window possible in console , during sleep()? using python 3.5 i see others use from msvcrt import getch but me says not exist.

c - Conversion character, and fgets() function didn't work as expected -

i trying write code find size of data types , here code: #include <stdio.h> #include <limits.h> #include <string.h> int main(int argc, const char * argv[]) { // insert code here... printf("choose 1 of following types relevant storage size\n(int, float, double, short, long, char: "); char mytype1[7] = ""; char mytype2[4] = "int"; char mytype3[7] = "double"; char mytype4[6] = "short"; char mytype5[5] = "long"; char mytype6[5] = "char"; char mytype7[6] = "float"; scanf("%s", mytype1); // fgets(mytype1, 7, stdin); if (strcmp(mytype1, mytype2) ==0){ printf("the 'int' variable size %lu\n", sizeof(int)); } else if (strcmp(mytype1, mytype3) ==0){ printf("the 'double' variable size %lu\n", sizeof(double)); } else if (strcmp(mytype1, mytype4) ==0){ printf("the

camera - Take picture with headphones button -

i want take pictures camera when headphones button pressed. but i'm getting runtime error saying "unable start receiver...takepicturefailed". mi mainactivity: public class mainactivity extends appcompatactivity{ protected static camera mycamera; private camerapreview mpreview; int icantcameras; int iactivecamera = 0; camera.parameters cpparameters; audiomanager am; static context context; public static string appname; private static final string tag = "mainactivity"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); appname = getstring(r.string.app_name_long); context = getapplicationcontext(); // register , unregister receiver of headset button = (audiomanager) this.getsystemservice(context.audio_service); } @override protected void onresume(){ super.onresume(); // check if there's camera if(!checkcamerahardware(thi

php - Drupal 8 Dynamic form ID -

i wrote module dynamically create blocks. in each block have form. problem want dynamic form id each form, in moduleblockform.php can define static 1 with public function getformid() { return 'mymodule_block_form'; } but want this: public function getformid() { return 'mymodule_block_form_' . $foo; } is possible ? thanks help sorry: can't comment yet, i'll write comment answer the problem see in julie pelletier 's answer, rand not generate unique number, suggest define private static integer slug, append each formid , increment it. example: private static $slug = 0; and in __construct() self::$slug = 0; and in getformid() self::$slug += 1; return 'mymodule_block_form_' . self::$slug; you can combine last 2 lines in one, wrote readability. hope helps.

android - Canvas returns black image on rotate -

i'm ussing opencv , face recognizer project example one, made robotic apps team, android , camera not expected, rotation has bugs , in order rotate camera view use in portrait orientation, have rotate canvas inside of camerabridgeviewbase class in deliveranddrawframe method , have next canvas rotation method: canvas.drawcolor(0, android.graphics.porterduff.mode.clear); canvas.rotate(180); mscale = canvas.getwidth() / (float) mcachebitmap.getheight(); float scale2 = canvas.getheight() / (float) mcachebitmap.getwidth(); if (scale2 > mscale) { mscale = scale2; } if (mscale != 0) { canvas.scale(mscale, mscale, 0, 0); } log.d(tag, "mstretch value: " + mscale); canvas.drawbitmap(mcachebitmap, 0, -mcachebitmap.getheight(), null); // ... when use rotate method value 90 canvas.rotate(90); returns image rotated 90 degrees expected, when rotate more 90 or less 90 like, 0, -90, 180, 270, etc. it returns black image :( what's problem code? it c

visual c++ - Not able to link a program in vc++ -

whenever try execute program in vc++ says build errors , .exe file not available. 1>------ build started: project: uahd, configuration: debug win32 ------ 1>link : error lnk2001: unresolved external symbol _winmaincrtstartup 1>c:\users\user\documents\visual studio 2010\projects\uahd\debug\uahd.exe : fatal error lnk1120: 1 unresolved externals ========== build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

javascript - How can I display and save the input/result image? -

i have following code i'm running using node.js . in code, histogram equalization process has been made. how can display , save both original image , result (histogram equalized) image? var jsfeat = require('./build/jsfeat.js'); var im = require('imagemagick'); var cols = 0; var rows = 0; var image = im.identify('abc.jpg', function(err, features){ if (!err){ cols = features.width; rows = features.height; } }); var my_matrix = new jsfeat.matrix_t(cols, rows, jsfeat.u8_t | jsfeat.c4_t, data_buffer = undefined); var equalization = new jsfeat.matrix_t(cols, rows, jsfeat.u8_t | jsfeat.c4_t); var result = jsfeat.imgproc.equalize_histogram(my_matrix, equalization); thanks.

actionscript 3 - If condition explanation AS3 -

i found code online. i'm not sure means. it's create bouncing ball. im not sure whats saying in if condition. is speed of object or it's going appear in stage? u please add //comment brief explanation. thank in advance! if ( this.x >= nstagewidth - 10 ) { this.x = nstagewidth - 10; nspeedx *= -1; } else if ( this.x <= 10 ) { this.x = 10; nspeedx *= -1; } if ( this.y >= nstageheight - 10 ) { this.y = nstageheight - 10; nspeedy *= -1; } else if ( this.y <= 10 ) { this.y = 10; nspeedy *= -1; } this code checks x or y property of object make sure it's within boundaries. if it's not, object's nspeedx or nspeedy property multiplied -1. for example, if x less 10 or greater or equal nstagewidth-10 , nspeedx multiplied -1, assume sends ob

c - Share pthread semaphore between processes -

i'm trying create shared semaphore class in c , share between 2 processes via shared memory. sharedmemory.h (shared across processes) typedef struct semaphore { int value; //- semaphore's value int wakeups; //- number of pending signals // avoid thread starvation pthread_mutex_t *mutex; //- used protect value , wakeups pthread_cond_t *cond; //- waiting on semaphore } semaphore; semaphore *sem; //- semaphore 1: free | 0: in use sharedmemory.c (shared across processes) //- initialize semaphore object semaphore *semaphore_init(int value) { semaphore *semaphore = (semaphore*) malloc(sizeof(semaphore)); semaphore->value = value; semaphore->wakeups = 0; //- mutex init pthread_mutexattr_init(&attrmutex); pthread_mutexattr_setpshared(&attrmutex, pthread_process_shared); semaphore->mutex = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t)); pthrea

java - Why does my printed equation keep printing the same number? -

i trying make adding game randomly generated numbers added not random though assigned them random each time. please. i'm still working on project stuck on part. code far: package addgame; import java.util.random; import java.util.scanner; public class add { private static scanner console; public static void main(string[] args) { system.out.println( "we going play adding game. type answer."); equation(); } public static void answer(scanner console) { } public static void equation() { int tries = 0; while (tries == 0) { random rand = new random(); int nums = rand.nextint(25) + 6; int totalnums = rand.nextint(4) + 1; int sumans = 0; (int = 1; <= totalnums + 1; i++) { system.out.print(nums + "+ "); sumans += nums; } system.out.print("= "); con

jsf - PrettyFaces redirect doesn't work -

i'm trying set view page particular url, doesn't work, here code: pretty-config.xml: <pretty-config> <url-mapping id="loginpage"> <pattern value="/app"></pattern> <view-id>/loginpage.xhtml</view-id> </url-mapping> </pretty-config> web.xml: <?xml version="1.0" encoding="utf-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> <display-name>firanycrm</display-name> <servlet> <servlet-name>faces servlet</servlet-name> <servlet-class>javax.faces.webapp.facesservlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>fa

r - Create monthly mean by time intervals -

sorry if has been posted looked hard , not find anything. i working monthly temperature observations 30 years, comprising january 1960 december 1989. looks this: > head(df) date temp 1 1960-01-01 22.92235 2 1960-02-01 23.07059 3 1960-03-01 23.10941 4 1960-04-01 20.78353 5 1960-05-01 17.45176 6 1960-06-01 17.31765 first, need average januaries, februaries, marches , etc whole period. then, same specific periods of time (3 years, 5 years, 10 years etc). for example, the average of jan, feb, mar etc between 1960 , 1964; the average of jan, feb, mar etc between 1965 , 1969; and on. the final result consist of month, period , temperature, this: month period temp jan 1960-1989 17 feb 1960-1989 12 mar 1960-1989 7 apr 1960-1989 9 may 1960-1989 15 jun 1960-1989 12 jul 1960-1989 17 aug 1960-1989 22 sep 1960-1989 21 oct 1960-1989 21 nov 1960-1989 18 dec 1960-1989 17 jan 1960-1964 17 feb 1960-1964 12 mar 1960-1

c# - Find records that have a minimum of 25 child records greater than 0 - LAMBDA -

i' m trying limit results contains @ least 25 records loadweight greater zero. (first 25 using take() ok in case). proxylist = proxylist .where(x => x.load.loaddetaillist .take(25) .where(y => y.loadweight > 0) .tolist(); thanks in advance. put where(y => y.loadweight > 0) first filter out records count; skip 24 records , check if there're any records far (i.e. 25 or more records): proxylist = proxylist .where(x => x.load.loaddetaillist .where(y => y.loadweight > 0) .skip(24) .any()) // any: have 25th item? .tolist();

c# - WPF DrawingContext: How to keep existing content when draw new content? -

i have drawingvisual , want draw grape tree, show screen after that, draw fox. this: public class gif : drawingvisual { void draw_geometry(geometry geo) { using (drawingcontext dc = renderopen()) { dc.drawgeometry(brushes.brown, new pen(brushes.brown, 0), geo); } } void draw_grape () { draw_geometry(grape); } void draw_fox () { draw_geometry(fox); } } problem when call draw_fox () , drawingcontext auto clear existing grape tree. want ask how keep existing drawing content when draw new geometry? thank! from documentation: when call close method of drawingcontext, current drawing content replaces previous drawing content defined drawingvisual. means there no way append new drawing content existing drawing content. i feel that's pretty clear. not possible literally ask. opening visual rendering always end new rendering replacing whatever there before. if want append

javascript - How can I create a multi-colum dropdown menu in Materialize CSS? -

i'm working on personal project , due high number of elements drop down menu, multi column (2 columns, precise) work better. how go accomplishing in materialize css? is similar have in mind? takes bit of custom css remove padding makes list items odd, shows 2 drop columns, , snaps 1 on smaller devices. html <div id="dropdown1" class="row dropdown-content"> <div class="col s12 m6"> <ul> <li>1</li> <li>2</li> <li>3</li> </ul> </div> <div class="col s12 m6"> <ul> <li>4</li> <li>5</li> <li>6</li> </ul> </div> </div> <nav> <div class="nav-wrapper"> <ul> <li><a class="dropdown-button" href="#!" data-activates="dropdown1">dropdown</a></li> </ul

javascript - Datetimepicker doesn't use the given format -

i'm using date time picker of jquery, it's not using given format. instead of using that, uses it's default date format , gives error in console: uncaught typeerror: f.mask.replace not function . error when lose focus of date time picker. something, though, error right after page loaded: maximum call stack size exceeded . how make sure uses given format? if need additional information, feel free ask. html <input id="start" value="01-01-2016" /> css $('#start').datetimepicker({ formattime: 'h:i', formatdate: 'dd-mm-yy', defaultdate: '01-01-2016', defaulttime: '10:00' }); additional information this date time picker code use. error ( uncaught typeerror: f.mask.replace not function ) on line 1743. this bug in master branch. already fixed , still exists in concatenated file jquery.datetimepicker.full.js . if not want use release versions , use file jquery.datetimep

c# - WebApi - Convert null string into null value -

what best way convert 'null' string (passed url) null value in webapi using attribute routing? url sample: localhost:29365/api/mycontroller/test/first/null/third api controller method sample: [httpget] [route("~/api/mycontroller/test/{first}/{second}/{third}")] public void test(string first, string second, string third) { ... } well option comparing if string value null. seems terrible. why not try passing parameters instead. [httpget] [route("~/api/mycontroller/test")] public void test(string first = null, string second = null, string third = null) { ... } url sample localhost:29365/api/mycontroller/test?first=myfirstvalue&third=mythirdvalue by not supplying second value null default.

html - Responsive - resize DIV width while maintaining height -

i trying figure out how best handle following case of responsive design. i need text box side of beer image grow / shrink it's width, maintain height match height of beer image. @ breakpoint have text box move under beer image. .beer-content { padding: 50px 68px; } .amber-beer { float: left; } .amber-beer img { margin-top: -21px; } .amber-beer-text { float: left; height: 374px; background: #f8eddf; margin: 0 0 0 20px; max-width: 725px; width: 100%; padding: 50px 50px 0 50px; font-size: 18px; } <div class="beer-content"> <div class="amber-beer"><img src="_img/beer-amber-ale.png" alt="amber ale" /></div> <div class="amber-beer-text"> <p class="beer-title"><img src="_img/beer-title-bars.png" alt="" /> amber</p> <p>amber beers style fall between light pale ales ,