Posts

Showing posts from August, 2015

c# - error CS0117 in Unity -

i working in unity 5.1 beginner, got error , i've no idea how solve this: assets/sampleassets/cameras/scripts/freelookcam.cs(39,32): error cs0117: `unityengine.screen' not contain definition `cursor' my script is: private void ondisable() { screen.cursor.lockstate = cursor.visible; } just remove screen. code becomes: private void ondisable(){ curser.lockstate = cursorlockmode.locked; } however, if want hide/display cursor use this: cursor.visible = true; cursor.visible = false;

redirect - Redirection from www.example.com to www.example.com/index.jsp -

i have setup apache2 , tomcat7 on ubuntu 14.04. my domain name www.example.com , want redirect www.example.com/index.jsp on tomcat login page. how can done? set works fine request made www.example.com/index.jsp. apache virtualhost setting is proxypass / ajp://localhost:8009/ proxypassreverse / ajp://localhost:8009/ the redirection in understanding should happen on apache. apache acting proxy , not serving requests can use directive ? , how make change. pointers appreciated i tried rewriting url in virtualhost doesn't seem working servername www.example.com <br> rewriteengine on <br> rewriterule ^http://www\.example\.com$ https://www.example.com/index.jsp [r] you can use following rewrite rule rewriteengine on rewriterule ^/$ /index.jsp [r] it search if, uri path starts , ends / redirect /index.jsp , should trick.

what does can't assign to literal mean in python? -

this question has answer here: python: can't assign literal 7 answers i have been writing programs in python, comes can't assign literal, mean? , causes it? i've searched try , find can't find it. the object on left-hand side of assignment statement can not literal. a literal string, number, tuple, list, dict, boolean, or none . example, these raise syntaxerror: can't assign literal : >>> 'foo' = 1 >>> 5 = 1 >>> [1, 2] = 3 this syntaxerror can happen through indirect assignment : >>> 'foo' in [1,2,3]: .... pass syntaxerror: can't assign literal in for-loop, python tries assign values 1, 2, 3 literal string 'foo' , raises syntaxerror. the fix, of course, supply variable name such foo , not string, 'foo' : for foo in [1,2,3]: pass

In Python, is there a way I can download all/some the image files (e.g. JPG/PNG) from a **Google Images** search result? -

is there way can download all/some image files (e.g. jpg/png) google images search result? i can use following code download one image know url: import urllib.request file = "facts.jpg" # file written url = "http://www.compassion.com/images/hunger-facts.jpg" response = urllib.request.urlopen (url) fh = open(file, "wb") #open file writing fh.write(response.read()) # read request while writing file to download multiple images, has been suggested define function , use function repeat task each image url write disk: def image_request(url, file): response = urllib.request.urlopen(url) fh = open(file, "wb") #open file writing fh.write(response.read()) and loop on list of urls with: for i, url in enumerate(urllist): image_request(url, str(i) + ".jpg") however, want download all/some image files (e.g. jpg/png) own search result google images without having list of image urls beforehand. p.s. please complete beginner ,

java - Why is this an illegal start of expression?and not a statement? -

after using javac in cmd illegal start of expression error , not statement. string firstname= "james"; string lastname= "oliver"; //display message system.out.println( "welcome " + "firstname" + "lastname" + + age + "years old";) try system.out.println( "welcome " + firstname + lastname + "you are" + age + "years old"); if want use contents of string variables not enclose them in "" , put ; outside of parenthesis.

c - printf("%d") doesn't display what I input -

my code: printf("enter number : "); scanf("%d", &number); printf("%d entered\n", &number); i input 2 , expected output : 2 entered actual output : 2293324 entered what's problem here? printf("%d entered\n", &number); is wrong because %d (in printf ) expects argument of type int , not int* . invokes undefined behavior seen in draft (n1570) of c11 standard (emphasis mine) : 7.21.6.1 fprintf function [...] if conversion specification invalid, behavior undefined. 282) if argument not correct type corresponding conversion specification, behavior undefined . fix using printf("%d entered\n", number); then, why scanf require & before variable name? keep in mind when use number , pass value of variable number , when use &number , pass address of number ( & address-of operator). so, scanf not need know value of number . needs address of (an int* i

c# - Library/API for tor .onion web calls -

is there library making web requests .onion websites? without using tor " firefox " needs cant use tor browser. i did googling , did not found solution regarding making simple web request .onion without using tor browser. there isn't library per se, way start tor , use proxy application. on linux starting tor without browser relativly straightforward. edit: looks tor.exe --defaults-torrc [path torrc] way start on windows.

c++ - Fullscreen mode on monitor A in dual-monitor setup breaks when moving windows from monitor B onto it -

i building win7/8/10 x64 direct3d11 desktop application allows user switch between windowed , fullscreen mode (proper dedicated fullscreen mode, not maximized window*). on dual-monitor setup encountering issues. the switch performed manually using idxgiswapchain::setfullscreenstate , works intended: monitor houses lion's share of window area (let's call monitor a) goes dedicated fullscreen mode while leaving other (monitor b) was, allowing user interact windows on b fullscreen application on a. however, if window on b dragged or resized crosses on a, application's fullscreen state gets disturbed: reverts windowed mode (leaving application's internal tracking variable out of sync), stays in quasi fullscreen mode seemingly refuses further mode switches, , on. same thing happens if window overlapped both , b before application went fullscreen mode gets focus. is there way prevent this? i wish os honor application's dedicated fullscreen mode , keep in robus

python - Why is Pygame's KMOD_SHIFT unresolved and crashing my code? -

i wrote simple program test detection of shift key being pressed, think ought work. main issue seems kmod_shift piece. searched out shift detection using pygame , test pygame.key.get_mods() & kmod_shift people said use, , in several code example well. however, in code warning kmod_shift unresolved reference, , when try run code, press key error: "name kmod_shift undefined". isn't pygame supposed define it? in other people's code examples of using this, seem using same me. doing wrong here? still major python newbie - guidance. #! /usr/bin/python3 import pygame pygame.init() screen_width, screen_height = 800, 600 screen_color = [128, 128, 128] game_display = pygame.display.set_mode((screen_width, screen_height)) pygame.display.set_caption('coloriffic') clock = pygame.time.clock() my_font = pygame.font.sysfont("monospace", 45) crashed = false shift_label = my_font.render("shift not pressed", 1, (0, 0, 0)) while not crash

php - MySQL returns data twice -

i have following code, simplified heavily while trying bottom of this: <?php $db_host = $_env['database_server']; $db_pass = 'dummypassword'; $db_user = 'user'; $db_name = 'database'; $db_char = 'utf8'; $db = new pdo("mysql:host=$db_host;dbname=$db_name;charset=$db_char", $db_user, $db_pass); $db->setattribute(pdo::attr_errmode, pdo::errmode_exception); $email = 'david@example.com'; if (!empty(trim($email))) { $sql = 'select * staff'; $query = $db->prepare($sql); $query->execute(); $results = $query->fetchall(); echo '<pre>'; print_r($results); echo '</pre>'; } ?> when run this, query works fine , no errors. is: array ( [0] => array ( [staff_id] => 1 [0] => 1 [staff_org] => 1 [1] => 1 [staff_email] =

javascript - No update in the mongoose-cache after change in the collection -

i have mean stack based application , recently, trying implement caching mechanism caching query results. implemented mongoose-cache . mongoose-cache configuration require('mongoose-cache').install(mongoose, {max: 150, maxage:1000*60*10}); i have 2 document in sample collection {name:'dale', dep:2}, {name:'john', dep:4} i run query mongoose-cache enabled , maxage 10 minutes . sample.find().cache().exec(function (err, doc) { // returns 2 document }); next, inserted 1 more document {name:'rasig', dep:4} , execute same query sample.find().cache().exec(function (err, doc) { // returns 2 document instead of 3 }); i executed same query twice within 10 minutes, though there change in collection, got previous result. there way drop cached result once there change in collection. if not, can suggest else implement same. i author of new mongoose module called monc using monc quite easy clean or purge

python - Django update MySQL database issue involving foreign keys -

good morning all, i have following 2 models: from django.db import models django.contrib.auth.models import user # create models here. class straightredteam(models.model): teamid = models.integerfield(primary_key=true) teamname = models.charfield(max_length=36) country = models.charfield(max_length=36,null=true) stadium = models.charfield(max_length=36,null=true) homepageurl = models.charfield(max_length=36,null=true) wikilink = models.charfield(max_length=36,null=true) teamcode = models.charfield(max_length=5,null=true) teamshortname = models.charfield(max_length=24,null=true) currentteam = models.positivesmallintegerfield(null=true) def natural_key(self): return self.teamname class meta: managed = true db_table = 'straightred_team' class straightredfixture(models.model): fixtureid = models.integerfield(primary_key=true) home_team = models.foreignkey('straightred.straightredteam',

c - How can I replace delay() by millis()? -

after while, final result want can't use delay because need different time different strip, need replace delay() millis() in code: #include <fastled.h> #define num_leds1 10 #define num_leds2 6 #define data_pin1 6 #define data_pin2 7 crgb leds1[num_leds1]; crgb leds2[num_leds2]; void setup() { fastled.addleds<neopixel, data_pin1>(leds1, num_leds1); fastled.addleds<neopixel, data_pin2>(leds2, num_leds2); } int dot_delay1[ ] = { 100,200,300,400,500,600,700,800,900,1000 }; int dot_delay2[ ] = { 100,200,300,400,500,600 }; void loop() { for(int dot = 0; dot < num_leds1; dot++) for(int dot = 0; dot < num_leds2; dot++) { leds1[dot] = crgb::blue; leds2[dot] = crgb::blue; fastled.show(); leds1[dot] = crgb::black; leds2[dot] = crgb::black; delay( dot_delay1[ dot ] ); // need put second delay, // can't put more 1 delay. // need refactor code millis() function instead of delay() } }

bundler - middleman server error with 'listen' 3.0.3 gem instead of 2.10.1 -

i'm running on windows 8.1 , try run 'middleman server' (with gem version 2.4.8 , middleman version 3.3.12). when doing following error (see below appendix full error message): " have activated listen 3.0.3, gemfile requires listen 2.10.1" yet gem 'listen' not explicitely written in gemfile, must dependency else. so did explicitely add in gemfile : gem 'listen', '~> 2.10.1' and run again $bundle install yet when run again '$middleman server' not work. in terminal check version of 'listen' gem have , see it's : c:\users\edouard\desktop\stylus>bundle show listen c:/ruby22/lib/ruby/gems/2.2.0/gems/listen-2.10.1 would have lead on how solve ? because don't have clue.. appendix - whole error message : c:\users\edouard\desktop\stylus>middleman server warn: unresolved specs during gem::specification.reset: rack (< 2.0, >= 1.0, >= 1.0.0, >= 1.4.5) uber (~> 0.0.4) activesupport

android - Integrate Fabric with Libgdx -

Image
i trying integrate fabric sdk libgdx application android. the android studio plugin provided fabric.io not work gradle build files (generated libgdx tool ). plugin not touch them. so tried edit them manually. build.gradle file: buildscript { repositories { mavencentral() maven { url 'https://maven.fabric.io/public' } } dependencies { classpath 'com.android.tools.build:gradle:1.1.+' classpath 'io.fabric.tools:gradle:1.+' } } allprojects { apply plugin: "eclipse" apply plugin: "idea" version = '1.0' ext { appname = 'app' gdxversion = '1.5.4' robovmversion = '1.0.0-beta-04' box2dlightsversion = '1.3' ashleyversion = '1.3.1' aiversion = '1.5.0' } repositories { mavencentral() maven { url "https://oss.sonatype.org/content/repositories/snaps

php - How to pass more than one argv variable using add slashes? -

i wondered right syntax passing more 1 variable using add slashes? tried many variation until now: exec('php email.php "'.addslashes($body).'"' . "'.addslashes($msg).'"'); exec('php email.php "'.addslashes($body).'"' + "'.addslashes($msg).'"'); exec('php email.php "'.addslashes($body).'"' & "'.addslashes($msg).'"'); exec('php email.php "'.addslashes($body, $msg).'"''); i have check example passing 1 argv , it's working fine: exec('php email.php "'.addslashes($body).'"'); ------------ after comments ----------- the php email.php waiting in $argv 2 inputs in order run right. therefore main issue how pass him in 1 time 2 parameters: $body & $msg let if ran web page this: www.mydomain/email.php?body=value1&msg=value2

Eloquent JavaScript: Can't understand recursion example -

this question has answer here: how eloquent javascript recursion example terminate return 1 still output exponential value 2 answers from page 50 of haverbeke's second edition. added couple of console.log try better track progress. function power(base, exponent) { if (exponent == 0) { console.log("line 5 " + base + " " + exponent); return 1; } else console.log("line 10 " + base + " " + exponent); return base * power(base, exponent -1); } console.log(power(2,3)); // output line 10 2 3 line 10 2 2 line 10 2 1 line 5 2 0 8 // i expect final output 1 since when if (exponent == 0) true, next statement return 1; , appears enter else 1 more time return 8. shouldn't return kick out of function. obviously newbie or wouldn't stuck on page 50 of supposedly beginner book. thank

java - How to enable s3 path style access in jclouds -

normally, when i'm using aws s3 java sdk, can enable path style access in following way: s3clientoptions clientoptions = new s3clientoptions() clientoptions.setpathstyleaccess(true) awss3client.sets3clientoptions(clientoptions) we transitioning our code use jclouds instead, can't find documentation indicates either how specify client options, or setting path style access blob or blobstore. any appreciated. property_s3_virtual_host_buckets controls path-style access, configured part of contextbuilder.overrides . generic s3 api defaults false, or path-style access, while specific aws-s3 provider defaults true, or host-style access.

java - Error: android.os.NetworkOnMainThreadException -

this question has answer here: how fix android.os.networkonmainthreadexception? 46 answers i'm making android app. i've made activity loads information web , use information set listview. if run app works fine, if open activity (which described above) gives error: android.os.networkonmainthreadexception activity file: package com.a3gaatleren; import android.support.v7.app.actionbaractivity; import java.io.ioexception; import java.net.malformedurlexception; import java.util.arraylist; import java.util.arrays; import android.os.asynctask; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.widget.arrayadapter; import android.widget.listview; import com.a3gaatleren.readfile; public class agenda extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) {

google chrome - Cast Youtube videos inside my Android app directly to Youtube (in chromecast or roku or tv) -

i building android app youtube videos. want add casting support these videos within app. don't want build separate receiver app in chromecast want use existing youtube receiver app in chromecast/roku..etc. using 'youtube android player' api embed videos in app can't find cast support in-built. willing move html5 youtube embedding if casting support works way. would appreciate if can suggest way if able build such cast'ing support of youtube videos in android app? (i have researched internet , of 2013 & '14 posts suggest it's not possible. know if has changed since then) there no support in cast sdk cast yt videos; folks have used custom receiver , have used embedded iframe show yt videos not perfect solution , has issues; example cannot skip ads, etc.

html - Send all data from inputs in a form through email without defining each field -

i have 150+ forms different input ids. need collect data inputs , send them on through email directly without defining fields. see site https://formspree.io/ has feature want know how can implement myself. thank you! this how site handles form: <form action="//formspree.io/your@email.com" method="post"> <input type="text" name="name"> <input type="email" name="_replyto"> <input type="submit" value="send"> </form> this allows inputs sent directly given email. nevermind, got answer. foreach ($_post $key => $value) $body .= $key . ' -> ' . $value . '<br>';

c - define constant variable in a structure initiation -

i tried follow following link in order initiate data: struct dmparam { char *p; char *v; }; struct dmobj { int a; int b; const struct dmparam * const *dmparam; }; const struct dmobj dmobj[] = { {1, 11, null}, {2, 22, (struct dmparam * const []) {//params {"p1", "v1"}, {"p2", "v2"}, }//params }, {3, 33, null}, }; but got warnings in compilation test.c:35:3: warning: braces around scalar initializer [enabled default] {"p1", "v1"}, ^ test.c:35:3: warning: (near initialization ‘(anonymous)[0]’) [enabled default] test.c:35:3: warning: initialization incompatible pointer type [enabled default] test.c:35:3: warning: (near initialization ‘(anonymous)[0]’) [enabled default] test.c:35:3: warning: excess elements in scalar initializer [enabled default] test.c:35:3: warning: (near initialization ‘(anonymous)[0]’) [enabled default] test.c:36:3: warning

quantmod - Using ifelse to create a running tally in R -

i trying quantitative modeling in r. i'm not getting error message, results not need. i newbie, here complete code sample. `library(quantmod) #building data frame , xts show dividends, splits , technical indicators getsymbols(c("amzn")) playground <- data.frame(amzn) playground$date <- as.date(row.names(playground)) playground$wday <- as.posixlt(playground$date)$wday #day of week playground$yday <- as.posixlt(playground$date)$mday #day of month playground$mon <- as.posixlt(playground$date)$mon #month of year playground$rsi <- rsi(playground$amzn.adjusted, n = 5, matype="ema") #can add moving average type matype = playground$macd <- macd(amzn, nfast = 12, nslow = 26, nsig = 9) playground$div <- getdividends('amzn', = "2007-01-01", = sys.date(), src = "google", auto.assign = false) playground$split <- getsplits('amzn', = "2007-01-01", = sys.date(), src = "google", auto.ass

regex - Python urllib2 request blinking cursor no response -

i'm trying extract data bbb no response. don't error messages, blinking cursor. regex issue? also, if see can improve on in terms of efficiency or coding style, open advice! here code: import urllib2 import re print "enter industry keyword." print "example: florists, construction, tiles" keyword = raw_input('> ') print "how many pages dig through bbb?" total_pages = raw_input('> ') print "working..." page_number = 1 address_list = [] url = 'https://www.bbb.org/search/?type=category&input=' + keyword + '&filter=business&page=' + str(page_number) req = urllib2.request(url) req.add_header('user-agent', 'mozilla/5.0') resp = urllib2.urlopen(req) respdata = resp.read() address_pattern = r'<address>(.*?)<\/address>' while page_number <= total_pages: business_address = re.findall(address_pattern,str(respdata)) each in business_ad

javascript - php page tabs not loading using AJAX -

i using tabs class got codecanyon... have couple of tabs want show, information php files(not large or resource consuming)... i use code below load pages. , on initial load first page load.(it has access db etc when loading) , can browse second page(which @ point html). want go php page, keeps loading , loading... i cannot use or post method in library using method pass variable , post discards away method value... is there way see why page not load when php code comes in? i did notice showing when check console in chrome(it apears once page loads: http://website/includes/tabs/inc/getcontent.php?filename=%2fuser_management%2fuser_profile.php&password=apphptabs failed load resource: server responded status of 500 (internal server error)` but not 100% sure of cause it. because loads perfectly... ## *** include tabs class define ("tabs_dir", "includes/tabs/"); require_once(tabs_dir."tabs.class.php"); ## *** create tabs obje

MT Quartz Magento Theme Less CSS Precompiler Issue -

i'm using mt quartz magento theme. uses less css pre-compiler. theme settings have option change theme colours. these written file on file system design_default.less. there file @ same level named design_default.css. changing colours in end result in less file being updated. however, css file not updated when happens. frontend calls css file styling, means front end colours not update. has idea why happening? i'm new css pre compilers , appreciated. in advance.

php - How to eagerly load multiple related models in Laravel 5? -

i have relationships follows: an order has many product s, , product has many order s. class order extends model { ... public function products() { return $this->belongstomany('app\product'); } } a product has many image s, , image belongs product . class product extends model { ... public function images() { return $this->hasmany('app\image'); } } for order $order , can load products $order->load('products') , how eagerly load images of products $order ? there 2 ways achieve this, can $order->load('products.images') or add property $with = ['images'] product model/entity.

libgdx - frame drop on game initial start -

i loading assets using assetmanager in splashscreen , dispose assetmanager properly. using tiled map , various actors stage. when create stage , initialize actors , setthescreen on game's frame rate like: 45,47,50,52,47,55 , recovers 60 , never drops below 59. on start game lags 5-10 seconds , recovers , maintain 60 fps. has experienced that, normal?

html - Make a div inside another its header -

Image
this 1 little difficult explain: have 1 div within another, inside div supposed act header containing div. problem need padding in containing div, contained adjust padding. how keep padding of container, have contained snap top, left , right 0 margin? here's code: <div class="notification"> <div class="notification_head"> <p>testing notification.</p> </div> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. aenean congue nibh vel velit posuere, eu rhoncus purus interdum. praesent urna metus, mollis sed blandit ut, bibendum @ neque. aenean nulla metus, faucibus eget metus pharetra, ullamcorper placerat quam. aenean euismod sagittis hendrerit. integer vel dolor nibh. nulla dignissim lacinia orci eget pellentesque. donec id scelerisque metus. proin eleifend finibus tellus @ malesuada. praesent bibendum, est bibendum sagittis dignissim, mi magna imperdiet quam, nec laoreet massa ante et arc

html - Border-Radius text overflowing -

you can see webpage here: http://forumalliance.net/api/clan.php?clan=striking but can see words breaking , splitting mid way. css. #clandetails{ text-align:center; border-radius: 10px; border: 3px solid #bada55; width:50%; margin-left:25%; margin-right:25%; padding: 10px; word-wrap:break-word; } #intro{ border-radius: 10px; border: 3px dashed lightskyblue; padding: 6px; } i tried remove word-wrap:break-word; description text over-flows past border.... you can fix adding white-space: pre-wrap; pre tag. prevent words wrapping mid-way in preformatted text: #intro > pre { white-space: pre-wrap; }

java - Automatically created MainActivity has errors -

i have started java , android programming , eclipse created mainacitivity me: package com.dummies.android.lautlosmodus; import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.menuitem; public class mainactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.main, menu); return true; } @override public boolean onoptionsitemselected(menuitem item) { // handle action bar item clicks here. action bar // automatically handle clicks on home/up button, long // specify parent activity in androidmanifest.xml. int id = item.getitemid(); if (id == r.id.action_settings) { return true; } return super.onop

python - Between double curly braces: replace particular text -

i've got string (python 2.7.3) rendered template in django don't think specific django. string comes document.xml file inside docx file. i'm extacting document xml rendering , putting inside docx simple mail merge type stuff. one of issues, other obvious limitations template tags can use, word likes drop in whole bunch of xml if edit text in word. for needs, i'd successful if could find occurrences of &quot; between double curly braces , replace quote " . i'd replace &quot; " in following: word_docxml = 'some text here {{form.letterdate|date:&quot;y-m-d&quot;}} , more text' i reading on these: python regex remove substrings inside curly braces replace string located between but having trouble putting together. how remove/strip inside , including < > in between {{ }} 's in mess following: <w:rpr> <w:rfonts w:eastasia="times new roman" w:cs="arial" w:ascii=&quo

sqlite - iOS sqlcipher fmdb “File is encrypted or is not a database” -

this tutorial works fine following pieces of code. pod 'fmdb/sqlcipher' ... - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { ... nsarray *documentpaths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentdir = [documentpaths objectatindex:0]; self.databasepath = [documentdir stringbyappendingpathcomponent:@"gamedefault.sqlite"]; [self createandcheckdatabase]; ... } ... -(void) createandcheckdatabase { bool success; nsfilemanager *filemanager = [nsfilemanager defaultmanager]; success = [filemanager fileexistsatpath:self.databasepath]; if(success) return; // if file exists, dont // if file not exist, make copy of 1 in resources folder nsstring *databasepathfromapp = [[[nsbundle mainbundle] resourcepath] stringbyappendingpathcomponent:@"gamedefault.sqlite"]; // file path [filemanager cop

web - Creating Folder using php and user id through php session -

so want make little web app me , family , thing not work session set in verify.php : $sql_select = 'select id email="'.$_session['name'].'" '; $result = mysql_query($sql_select); $row = mysql_fetch_array($result); $id = $row['id']; $_session['id']= $id; header('location: home.php'); exit; and make folder , insert , image in upload.php <?php session_start(); $id = $_session['id']; var_dump($_session); $gallery = 'gallery'; $dir = $_server['document_root'].'/files/'.$id.'/'.$gallery.'/'; @mkdir($dir, 0777, true); move_uploaded_file( $_files['file']['tmp_name'], $dir.$_files['file']['name'] ); the image uploading gallery folder not actual users folder , comes out when var_dump $_session array(3) { ["logged_in"]=> int(1) ["name"]=> null ["id"]=> null } but sure session alive.

c++ - Converting hex data stored as a string into a file -

preface: i making simple program in c++ involves font. when executes creates data folder includes text files readme, haven't found way automatically create .ttf program needs display text. first instinct open .ttf in text editor , try writing text file, of course didn't work. problem: i have file converted hex data this 00 01 00 00 00 10 00 40 00 04 00 c0 4f 53 2f 32 80 8f 7e ff 00 00 8e b8 00 00 00 4e 50 43 4c 54 ... 2298 more lines i feel though should able hard code hex data string located within project, , should able use data create .ttf file when program executes. unfortunately have not yet found way. given string looks above (or 1 make using find/replace), how go creating working .ttf file? first hex data file, might this 00 01 00 00 00 10 00 40 00 04 00 c0 4f 53 2f 32 80 8f 7e ff 00 00 8e b8 00 00 00 4e 50 43 4c 54 ... then, use text editor regex support (like sublime text) data looking this {0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x40,

css - layout with twitter-bootstrap form -

i have difficulties arrange css bootstrap form . on top of picture below layout , under layout obtain: http://s27.postimg.org/dfztgn35v/flow_root3665.png is: first column witn names aligned on last letter, , aligned input fields on left , on right. here css used: <div class="well"> <form class="form-horizontal" method="post"> <fieldset> <legend>event</legend> <div class="form-group"> <label for="input-append date" class="col-lg-1 control-label">date</label> <div class="col-lg-3"> <div class="input-group input-append date" id="startdatepicker"> <input type="text" class="form-control" name="datepicker" id="datepicker1" readonly style="background-color: white" /><span class="input-group-addon add-on"><span class="glyphicon glyphico

.net - C# json loop parse using json.net -

i have json file: https://s3.amazonaws.com/minecraft.download/versions/1.7.10/1.7.10.json i need names inside "libraries" loop. can explain me how it? if it's possible have read sub content present example here { "name": "org.lwjgl.lwjgl:lwjgl-platform:2.9.1", "natives": { "linux": "natives-linux", "windows": "natives-windows", "osx": "natives-osx" }, thank in advice something might you're looking for. list<string> nameslist = new list<string>(); dynamic json = jsonconvert.deserializeobject(jsontext); foreach (var item in json["libraries"]) { nameslist.add((string)item["name"]); }

javascript - Three.js + Blender + ColladaLoader: undefined "geometry" and "material" (r71) -

i'm loading .dae scene (from blender) with: var collada_loader = new three.colladaloader(); collada_loader.load( "resources/3d/objs.dae", function(collada) { obj1 = collada.scene.getchildbyname("obj1", true); obj1.position.set(0, 0, 0); obj1.material.color.sethex(0x003388); scene.add(obj1); obj2 = collada.scene.getchildbyname("obj2", true); obj2.position.set(100, 100, 100); obj2.material.color.sethex(0x003388); scene.add(obj2); obj3 = collada.scene.getchildbyname("obj3", true); obj3.position.set(-100, -100, -100); obj3.material.color.sethex(0x003388); scene.add(obj3); } ); but obj*.material , obj*.geometry properties undefined! why? found materials in loader's object , tried create mesh: var collada_loader = new three.colladaloader(); colla

Regression (logistic) in R: Finding x value (predictor) for a particular y value (outcome) -

Image
i've fitted logistic regression model predicts binary outcome vs mpg ( mtcars dataset). plot shown below. how can determine mpg value particular vs value? example, i'm interested in finding out mpg value when probability of vs 0.50. appreciate can provide! model <- glm(vs ~ mpg, data = mtcars, family = binomial) ggplot(mtcars, aes(mpg, vs)) + geom_point() + stat_smooth(method = "glm", method.args = list(family = "binomial"), se = false) the easiest way calculate predicted values model predict() function. can use numerical solver find particular intercepts. example findint <- function(model, value) { function(x) { predict(model, data.frame(mpg=x), type="response") - value } } uniroot(findint(model, .5), range(mtcars$mpg))$root # [1] 20.52229 here findint takes model , particular target value , returns function uniroot can solve 0 find solution.

menu - jQuery - From a nav link to a sliding expandable container -

the title must impossible understand, sorry that. try explain i'm trying do. using jquery slinding expand container. have nav menu, exemple: <nav id="nav"> <ul> <li><a href="#">home</a></li> <li><a href="#" data-cat="tech">technology</a></li> <li><a href="#" data-cat="world">world</a></li> </ul> </nav> and after that, temporary hided container: <div id="categories"> <div id="tech"> category "tech", links images (articles) </div> <div id="world"> category "world", links images (articles) </div> </div> what script needs "data-cat" attribute , slide respective div have "id". if there's category container, need show (sliding down). otherwise if there's expanded needs slide (like carousel) new toggled catego

sql server - Using a table field as part of an identifier -

i have coded following table , use the text entered yearid add prefixed 'year' in cast() . for example if named year 2 yearid field populated 'year2' . apply next number in sequence after year e.g. year55 etc. create table year( groupid int identity (10000, 1) not null, yearid varchar (10) not null default 'year' + cast(next value non_identity_incrementer varchar(10)), year nvarchar (50) not null, datetimemodified datetime not null default sysdatetime(), status nvarchar(50) not null, primary key clustered (groupid) ); a computed column might solution: create table [year] ( groupid int identity (10000, 1) not null, yearid 'year' + [year], [year] nvarchar (50) not null, datetimemodified datetime not null default sysdatetime(), status nvarchar(50) n

python - How do I access the array using the for loop in the while loop -

i working external file has data in form of: -12345 csee 35000 bart simpson -12346 csee 25000 harry potter -12350 economics 30000 krusty clown -13123 economics 55000 david cameron with first item being id, second subject, third salary, , rest being name of person. in part of program trying print information of people have salaries between values submitted user. have put data in list called lecturers put salaries in separate list called lecturers salary , tried make them integers because @ first thought reason loop wasn't working because when trying access them lectures loop thought might still part of string @ point. i have used loop in program print people teach specific subject. subject submitted user. tried use loop again salaries not working. print"" # god glory lecturer = [] lecturer_salary = [] x = 0 = " " print "" string = raw_input("please enter lecturers details: ") print "" def printformat(string):

Jaxb setting dynamic @XmlRootElement with Spring Web Services -

i have spring application consumes soap web services. have several classes quite simple , differ in @xmlrootelement . i'm wondering if there's way create more generic class can set root element on dymanically. here's few of classes root element being different. @xmlrootelement(name="safetydate") public class safetydaterequest extends carrier411requestimpl { } @xmlrootelement(name="checkallsafety") public class safetygetallrequest extends carrier411requestimpl { } @xmlrootelement(name="checksafetyupdates") public class safetygetupdatesrequest extends carrier411requestimpl { } in class, i'm processing these classes in following fashion: private void sendrequest(carrier411request request, carrier411responsehandler responsehandler) throws faultcodeexception { carrier411response response = (carrier411response) ws.marshalsendandreceive(registry.get(request.getclass()), request); checkresponseforfault(response); respo

node.js - Add worker to PM2 pool. Don't reload/restart existing workers -

env.: node.js on ubuntu, using pm2 programmatically. i have started pm2 3 instances via node on main code. suppose use pm2 command line delete 1 of instances. can add worker pool? can done without affecting operation of other workers? i suppose should use start method: pm2.start({ name : 'worker', script : 'api/workers/worker.js', // script run exec_mode : 'cluster', // or fork instances : 1, // optional: scale app 4 max_memory_restart : '100m', // optional: restart app if reaches 100mo autorestart : true }, function(err, apps) { pm2.disconnect(); }); however, if use pm2 monit you'll see 2 existing instances restarted , no other created. result still 2 running instances. update doesn't matter if cluster or fork -- behavior same. update 2 command line has scale option ( https://keymetrics.io/2015/03/26/pm2-clustering-made-easy/ ), don't see method on programmatic api documenta