Posts

Showing posts from June, 2015

Can't retrieve data properly from database in php -

i have 2 entries in tblstudentdetails having rollno = 0 , 1 whenever try retrieve data database first record i.e. rollno = 0 here code: <?php unset($_session['rollno']); unset($_session['studentname']); unset($_session['course']); include_once 'includes/dbconnection.php'; //echo $_post['txtrollno']; if ($_post['btnsubmit'] == 'submit') { if ($_post['txtrollno'] != '') { $query = "select studentname, course tblstudentdetails rollno = '$_post[txtrollno]'"; $result = mysql_query($query); $rowcount = mysql_num_rows($result); if ($rowcount == 0) { echo "you have entered incorrect roll no"; //header ('location: index.php'); }

How do I use a variable in AppleScript (called from within Automator) -

instead of "asdf" , want use input variable here. seems should easy, reason can't figure out. on run {input, parameters} -- type 'asdf' delay 1.900231 set timeoutseconds 2.0 set uiscript "keystroke \"asdf\"" dowithtimeout(uiscript, timeoutseconds) return input end run on dowithtimeout(uiscript, timeoutseconds) set enddate (current date) + timeoutseconds repeat try run script "tell application \"system events\" " & uiscript & " end tell" exit repeat on error errormessage if ((current date) > enddate) error "can not " & uiscript end if end try end repeat end dowithtimeout for example, if try set uiscript "keystroke input" , error automator: the action “run applescript” encountered error. check actionʼs properties , try running workflow again. figured out myself. feel dumb now. set uiscript "keystroke \

class - Java - Using reflection to attach data to object if its type matches a string -

so here's question java experts. i have definitions keep in text files, let's they're properties files. have wide variety of different objects of implement interface, we'll call cardable . guarantees methods attach these definitions , retrieve them display within application. public interface cardable { public void attach(card c); public card retrieve(); } now, when build static list(s) of these objects, types vary, see if type matches set of classes declared in definition so thing.bag.leatherbag= ... (definitions) if creating class (definition condensed show idea) public class leatherbag extends bag { ... } public class bag extends thing { ... } public class thing implements cardable { ... } the process go through list during pre-loading phase , assign specific card given class. defined arbitrarily as, instance, more classes specified (thing.bag.leatherbag more specific bag.leatherbag rule.) once break class names out of string, how

c++ - global scope enum and namespace conflict -

i have atl com service , in .idl file, i've declared enum so: in gourmet.idl typedef enum food { chocolate = 0, doughnut, hotdog } food; a header file automatically generated, creating gourmet_i.h. in .cpp file (let's call decadence.cpp) of same atl com project, #include gourmet_i.h. i've implemented class in .cpp , it's under namespace 'chocolate'. for example in decadence.cpp: #include "gourmet_i.h" namespace chocolate { // constructor void decadence::decadence() {} // ... , on } // namespace chocolate when compiled following error gourmet_i.h: error c2365: 'chocolate': redefinition; previous definition 'namespace' i see occurs because enum idl defined in global namespace, possible contain definition -- doesn't pollute global namespace -- , wouldn't have conflict? short of renaming namespace or enum member solution wrap contents of generated header file in namespace. not without p

Facebook authentication in a new browser instance Asp.net MVC -

i have asp.net mvc 4 app have feature in app can post user's wall. working fine, url https://www.facebook.com/dialog/oauth?client_id=xxxxx&redirect_uri=http://localhost:xxxxxx/&scope=publish_stream redirects facebook page , authenticates ,post message , redirects app. is possible open facebook authentication page in new browser instance , somehow close browser instance once message posted ? thanks ! not sure if covers want achieve using facebook feed dialog , can set display parameter appropriate value (e.g. popup) , let user publish story timeline.

Creating an HTML table in Javascript for use in an email? -

i read post 4 years old stating it's not possible pass html email body. i know if still true? my current javascript is: tablef = '<table style="font-size: 1.0em; border-collapse: collapse;">'; tablef += '<tr>'; tablef += '<td>ip addresses</td>'; tablef += '<td>hop number</td>'; tablef += '<td>average ms</td>'; tablef += '</tr>'; tablef += '<tr>'; for(var = 0; < iparray.length; i++){ tablef += '<td>'+ iparray[i]+'</td><td>' + hopnum[i]+'</td><td>' + msarray[i]+'</td>'; } tablef += '</tr></table>'; } and suffice doesn't convert table when mailto link used, writes html plain text. you cannot specify html content passed mail application using mailto link, since &qu

x86 - Multiply 2 Values in Assembly Language 8086? -

i multiplying 2 values input console window. using 32 bit registers eax, ebx , not multiplying values. program running, not multiplying. can detect problem? wrong in code? using kip.r.irvine link libraries in assembly language. here code: include irvine32.inc .data inputvalue1st byte "input 1st integer = ",0 inputvalue2nd byte "input 2nd integer = ",0 outputsummsg byte "the sum of 2 integers = ",0 num1 dd ? num2 dd ? sum dd ? .code main proc ; here calling our procedures call inputvalues call multiplyvalue call outputvalue call crlf exit main endp inputvalues proc ;----------- 1st value-------- ; input message call crlf mov edx,offset inputvalue1st call writestring call readint ; read integer mov num1, eax ; store value ;-----------for 2nd value---------- ; output prompt message mov edx,offset inputvalue2nd call writestring call readint ; read integer mov num2, ebx ;

c - What is the equivalent of IOCTL_STORAGE_QUERY_PROPERTY on linux? -

i trying hard drives serial number on linux without need root access. possible on windows via this source in essence deviceiocontrol ioctl_storage_query_property . ioctl version? you can ask udev, without needing root permissions. try command , note id_serial line: /sbin/udevadm info --query=property --name /dev/sda programatically you'd use libudev.

navigation - inserting google 'onclick' tracking link attribute in wordpress -

i looking way modify links on wordpress site tracks 3rd party links. i able find the, how create correct tracking code in google analytics, second part of process add specific link attributes. here example suggest replicate: <'a href="www.blog-hosting-service.com/myblog" onclick="_gaq.push(['_link', 'www.blog-hosting-service.com/myblog']); return false;">view blog does know can insert code link attributes can collect external clicks via google analytics? jquery best way in opinion. // start getting current page path (the 1 sending tracker) var pathname = window.location.pathname; // ready handler change links on hosts not equal location host $(document).ready(function() { $('a[href^="http://"]').filter(function() { return this.hostname && this.hostname !== location.hostname; }).click(function(e) { _gaq.push(['_link', pathname]); }); });

get - GetElementById Javascript can't access a value -

<html> <head> <title>calculator</title> <style type = "text/css"> #calculator{ width:164px; top:20%; right:50%; position:absolute; border:1px black solid; background-image:url('images.jpg'); } #matrix { float:right; border:1px black solid; width:100px; } #row1{ position:relative; width:17px; } </style> </head> <body> </div> <div id = "matrix"> <form> <table> <tr><td style = "width:40px"><input type = "text" id = "one"></input></td> <input type = "number" id = "two"></input></td></tr> <tr><td><input type = "number" id = "three"></input></td> <input type = "number" id = "four"></input></td></tr> </table> <input type = "submit" value = "count"

python - adding directory to sys.path /PYTHONPATH -

i trying import module particular directory. the problem if use sys.path.append(mod_directory) append path , open python interpreter, directory mod_directory gets added end of list sys.path. if export pythonpath variable before opening python interpreter, directory gets added start of list. in latter case can import module in former, cannot. can explain why happening , give me solution add mod_directory start, inside python script ? this working documented. paths specified in pythonpath documented coming after working directory before standard interpreter-supplied paths. sys.path.append() appends existing path. see here , here . if want particular directory come first, insert @ head of sys.path: import sys sys.path.insert(0,'/path/to/mod_directory') that said, there better ways manage imports either using pythonpath or manipulating sys.path directly. see, example, answers this question .

arrays - Remove function for tree c++ -

so need function removes last node of tree. im finding online says use vector instead of array, assignment says use array. im thinking of using 2 arrays not sure how implement it. please have code far, think need remove function. in advance #include <iostream> #include <string> using namespace std; template <class item> class tree { public: // typedef int value_type; typedef std::size_t size_type; static const size_type capacity = 30; tree() { used = 0; } void leftchild(int index) { if((2*index)+1 > used) { cout <<"no child" << endl; } else cout << "\nleft child of index " << index << ": " << data[(2*index)+1] << endl; } void rightchild (int index) { if((2*index)+2 >= used) { cout <<"no child" << endl; } else cout << "\nright child of i

arrays - How do I make each word in a string a variable with PHP -

how make each word separate variable if string contains 3 words? searched , searched have found tutorial on how this. appreciated. php's explode should looking for. http://php.net/manual/en/function.explode.php $pizza = "piece1 piece2 piece3 piece4 piece5 piece6"; $pieces = explode(" ", $pizza);

javascript - Select previous input with jQuery -

how can go previous input when hitting backspace on empty input? $('input').bind('input', function() { if (this.value.length >= $(this).attr('maxlength')) { $(this).next().select(); } if (this.value.length == 0) { $(this).prev().select(); } }); jsfiddle: http://jsfiddle.net/ewykx/ the input event not fire if element has empty value because there's no value change. a keyup check backspace press should suffice. assuming input elements direct siblings in example: $('input').on('input propertychange', function() { if (this.value.length >= this.maxlength) { $(this).next().focus(); } }).keyup(function(e) { if (e.which === 8 && !this.value) { $(this).prev().focus(); } }); fiddle i've added propertychange listener fallback old ie, can remove if don't feel using ugly hack support old ie. i've swapped .

java - Made new SQLitedatabase Table does not exist -

my old sqlitedatabase wasn't working way wanted figured delete old dbadapter folder , dbhelper folder , made new database ground 2 new tables,new column names , new database_name after linked app new strings , cursors i'm getting nullpoint crash , i'm getting these errors in logcat. update: i've changed oncreate parameter db , solved invalid tables error have table "players"(myfirsttable) not exist error. update:new logcat 04-19 19:56:02.781: e/androidruntime(9179): fatal exception: main 04-19 19:56:02.781: e/androidruntime(9179): android.database.sqlite.sqliteexception: no such table: players (code 1): , while compiling: select _id, username players 04-19 19:56:02.781: e/androidruntime(9179): @ android.database.sqlite.sqliteconnection.nativepreparestatement(native method) 04-19 19:56:02.781: e/androidruntime(9179): @ android.database.sqlite.sqliteconnection.acquirepreparedstatement(sqliteconnection.java:882) 04-19 19:56:02.781: e/androidrunt

Permission error when trying to use chrome.fileSystem chooseEntry -

when trying use chrome.filesystem.chooseentry({ type: 'openfile' },chooseentrycallback)` on canary 28.0.1483.0 , following error in console: chrome.filesystem not available: not have permission access api. ensure required permission or manifest property included in manifest.json. i require read access, , how permissions option in manifest file looks like: "permissions": [ { "filesystem": [] }, "contextmenus", "clipboardwrite", "storage" ], this works fine stable 26.0.1410.64 question whether there manifest permission changes need updated. note: chrome running on windows 8, , when opening file via drag 'n drop opened without errors. i'm guessing problem chooseentry ? based on @sowbug's comment fixed issue changing filesystem permission list item: "permissions": [ "filesystem" ], edit: include extended write permission: "permission

excel - Splitting long row of text/numbers into multiple rows of specific length -

i have long line of text, thousands long this 76561197997162298 76561197997094193 76561197996891032 76561197996814030 76561197995825191 76561197995316081 76561197995286134 and simple way split rows of 100 long output someway import excel, unless excel can it, though unable find way. long dont have coding, done in language can run on windows pc. if there program it, use well. otherwise have devise hack job using macro recorder thanks! actually, best method asking! enjoy http://www.softpedia.com/get/system/file-management/text-file-splitter.shtml it's called text file splitter 2.0.4

Encoding URL partially in Javascript and PHP (url tweak) -

that might strange when want encode url partially, caught in situation , seems got no other solution... here code snippet $url = isset($_get['u']) ? esc_url($_get['u']) : ''; $image = isset($_get['i']) ? $_get['i'] : ''; maybeappend = '<a href="?ajax=photo_thickbox&amp;i=' + encodeuricomponent(img.src) + '&amp;u=<?php echo urlencode($url); ?>&amp;height=400&amp;width=500" title="" class="thickbox"><img src="' + img.src + '" ' + img_attr + '/></a>'; its taken wordpress /wp-admin/press-this.php issue is, cant post site via press this bookmarklet i searched google, studied wordpress forums , found need tweek press this button in bookmark tool bar in broswer.. but me, not solution,,why? obviously, cant teach every visitor change in broswer..so have edit code residing on server... how can e

ruby on rails - Carrierwave / Fog / S3 "is not a recognized storage provider" -

i have rails app using carrierwave file uploads. has been working fine want start using amazon s3 image storage. getting error: argumenterror ( not recognized storage provider): app/controllers/salons_controller.rb:52:in `update' i have made sure have latest gems carrierwave , fog. in gemfile: gem 'carrierwave' gem 'aws-sdk' gem 'fog' fog.rb looks like: carrierwave.configure |config| config.fog_credentials = { :provider => 'aws', :aws_access_key_id => 'myaccesskey', :aws_secret_access_key => 'mysecretkaccesskey', :region => 'us-east-1' } config.fog_directory = 'andrunix' config.fog_public = true config.fog_attributes = {'cache-control'=>'max-age=315576000'} end the uploader class looks like: class salonimageuploader < carrierwave::uploader::base include carrierwave::rmagick

debugging - Python's sys.settrace won't create c_call events -

the documentation sys.settrace says can report calls c or builtin functions. when try following program, expect see c_call event, nothing happens: import sys def tracer(frame, event, arg): print(frame, event, arg) return tracer sys.settrace(tracer) x = len([1,2,3]) any ideas what's wrong here? can post example use of sys.settrace generates c_call event? edit: tried python 3.2, , gave me no events. tried python 2.7 , gave me 2 call -s (not c_call -s). still weird. the docs wrong, c_call events never sent trace function: http://bugs.python.org/issue17799

How can I get gnuplot to use the default matlab color scheme? -

i'm trying compare data plot made matlab. want use gnuplot, color scheme different , makes difficult compare plots. how can gnuplot use matlab's "jet" color theme? the solution taken this page : set palette defined (0 0.0 0.0 0.5, \ 1 0.0 0.0 1.0, \ 2 0.0 0.5 1.0, \ 3 0.0 1.0 1.0, \ 4 0.5 1.0 0.5, \ 5 1.0 1.0 0.0, \ 6 1.0 0.5 0.0, \ 7 1.0 0.0 0.0, \ 8 0.5 0.0 0.0 )

Shell script cut the beginning and the end of a file -

so have file , i'd cut first 33 lines , last 6 lines of it. trying whole file in cat command (cat file) , use "head" , "tail" commands remove parts, don't know how so. eg (this idea) cat file - head -n 33 file - tail -n 6 file how supposed this? possible "sed" (how)? in advance. this want: $ tail -n +34 file | head -n -6 see tail -n, --lines=k output last k lines, instead of last 10; or use -n +k output lines starting kth and head -n, --lines=[-]k print first k lines instead of first 10; leading '-', print last k lines of each file man pages. example: $ cat file 1 2 3 4 5 6 7 8 $ tail -n +4 file | head -n -2 4 5 6 notice don't need cat (see uuoc ).

How to make Android App from existing JAva Code? -

i have multiplayer chess program , wanted know if there easy way make app it. if worth android sdks on eclipse, have code whole thing again or can use java code making app? it depends on libraries you're using in game , support in android. if use java existing implementation, you'll hopefully, have write ui bits, , erst of logic should work. if desktop app you're trying port, may have performance issues (given you're running on mobile device now), there changes necessary. if you're using graphics libraries, check support on android. libraries have reputation of having issues on android.

Drupal- Looking for code to print tweet to node-type.tpl.php -

i using tweet module in drupal 7. need code use printing tweet field in node-type.tpl.php. unfortunately have been unable find correct code make link appear in node. using contemplate found following code; <?php echo $content['tweet']; ?> <?php echo $content['field_tweet']; ?> <?php echo render($content['tweet']); ?> <?php echo render($content['field_tweet']); ?> <?php print $node->content['body']['#object']->content['links']['tweet']['#theme'] ?> <?php print $node->content['body']['#object']->content['links']['tweet']['#attributes']['class'][1]?> <?php print $node->content['body']['#object']->content['links']['tweet']['#attributes']['class'][0]?> <?php print $node->content['body']['#object']->content['links']['tweet

javascript - Getting a count of Documents (Rows) using mapReduce in MongoDb -

i hate re-post stuff feel though i've typed same syntax of issues i've looked up. i'm trying map down count of how many rows there price greater 9000. can tell me i'm doing wrong? var map1 = function(){ if(this.price > 9000) { emit(this._id, {count: 1}); } }; var red1 = function(keyid, values){ var count = 0; values.foreach(function(v) { count +=v['count']; }); return{count: count}; } db.plots.mapreduce(map1, red1, {out: "query1"}) my results end this... > db.query1.find() { "_id" : objectid("5170609afa9e8646fc906815"), "value" : { "count" : 1 } } { "_id" : objectid("5170609afa9e8646fc906816"), "value" : { "count" : 1 } } { "_id" : objectid("5170609afa9e8646fc90681c"), "value" : { "count" : 1 } } { "_id" : objectid("5170609afa9e8646fc906834"), &

ZfcUser and Zend Framework 2 -

i love zfcuser , use every project develop. works great, looking expand usage of bit. are there examples can offer checking identity in controller? have function fires when action given function accessed... add authentication function, said, runs in controller. any advice (or documentation?) appreciated! thanks checking auth identity in controller pretty straightforward. public function thataction() { $auth = $this->getservicelocator()->get('zfcuser_auth_service'); if( $auth->hasidentity() ) $user = $auth->getidentity(); } pretty easy right! can find more, here: https://github.com/zf-commons/zfcuser/wiki/how-to-check-if-the-user-is-logged-in the user object back, user entity. if want customize user entity, have small blog post here may help: http://circlical.com/blog/2013/4/1/l5wftnf3p7oks5561bohmb9vkpasp6

Syncing sprite animations in cocos2d -

every , add pulsating sprites scene so: ccspritebatchnode *batch = (ccspritebatchnode*) [scene getchildbytag: foo1]; sprite = [ccsprite spritewithbatchnode:batch rect:cgrectmake(0, 0, 128, 128)]; sprite.position = foo2 cctintto *a = [cctintto actionwithduration: .5 red:128 green: 128 blue: 128]; cctintto *b = [cctintto actionwithduration: .5 red:255 green: 255 blue: 255]; [sprite runaction:[ccrepeatforever actionwithaction: [ccsequence actionone: two: b]]]; [batch addchild: sprite]; i have sprites pulsating in sync, how go this? hmmm ... not easy. way i'd see of doing schedule 'flasherramp' so: in .h nsmutablearray *flashers; in .m, init method flashers = [[nsmutablearray array] retain]; // choose own arc flavor, if retain // dont forget release in dealloc [self schedule:@selector(flasherramp) interval:1.0f]; in .m, create sprite foo2.visible=no; [flashers addobject foo2]; f

C++ multithreading with openMP: poor performance despite localized variables (false sharing?) -

i have run weird openmp problem. the task take vector of strings , split each element contained k-mers (all contained substrings of length k). should parallelize trivially along elements of vector, k-merification procedure happens independently each element. want store results in map/set stl data structure ( std::map<long long, std::map<std::string, std::set<unsigned int> > > local_forreturn ) , , allocate thread-local variable that. the achieved parallelization behaviour, however, surprisingly bad - top on linux shows cpu usage of ~ 200%, despite running 40 threads on 40 core machine. (and have tested #omp critical section not bottleneck). my hunch might related false sharing, actual data contained in localized map/set stl classes end on heap. however, have neither idea of how test intuition, or how reduce false sharing stl constructs (if problem). appreciate ideas! complete code: #include <string> #include <assert.h> #include <set> #

How to pass html email parameters to an asp.net page -

i need pass html email parameters var1 , var2 asp.net page , run asp.net web service asp.net page use var1 , var2 gotten html email. appreciate on , in advance. your email have link like <a href="yoursite/default.aspx?var1=value1&amp;var2=value2">text</a> then can info on default.aspx page with protected void page_load(object sender, eventargs e) { var var1 = request.querystring["var1"]; var var2 = request.querystring["var2"]; }

multithreading - Python for loop using Threading or multiprocessing -

all, rather new , looking assistance. need perform string search on data set compressed 20 gb of data. have 8 core ubuntu box 32 gb of ram can use crunch through not able implement nor determine best possible code such task. threading or multiprocessing best such task? please provide code samples. thank you. please see current code; #!/usr/bin/python import sys logs = [] iplist = [] logs = open(sys.argv[1], 'r').readlines() iplist = open(sys.argv[2], 'r').readlines() print "+loaded {0} entries {1}".format(len(logs), sys.argv[1]) print "+loaded {0} entries {1}".format(len(iplist), sys.argv[2]) in logs: b in iplist: if a.lower().strip() in b.lower().strip() print "match! --> {0}".format(a.lower().strip()) i'm not sure if multithreading can you, code has problem bad performance: reading logs in 1 go consumes incredible amounts of ram , thrashes cache. instead, open , read sequentially, after mak

html - -moz- , -webkit- like other prefixes properties -

we use specific rules every browsers -moz- , -webkit- couldn't found site providing such tutorial. have googled couldn't find. please know site providing such tutorial prefixes. i know prefixes properties browsers. (not properties tutorial that) i have searched , found http://reference.sitepoint.com/css/vendorspecific site has provided information looking for. have @ http://css-tricks.com/how-to-deal-with-vendor-prefixes/ i have found http://cssprefixer.appspot.com/ have fun.

helix 3d toolkit - Read .obj File with Texture in WPF -

i trying load .obj file using helix tool kit code. didn't texture included .obj file. objreader studioreader = new objreader(); model3d m3d = studioreader.read("model/2 seat sofa .obj"); transform3dgroup transform = new transform3dgroup(); rotatetransform3d rotatetrans = new rotatetransform3d(); rotatetrans.rotation = new axisanglerotation3d(new vector3d(1, 0, 0), 0); transform.children.add(rotatetrans); rotatetrans.rotation = new axisanglerotation3d(new vector3d(0, 0, 1), 0); transform.children.add(rotatetrans); translatetransform3d translatetrans = new translatetransform3d(0, 20, 0); transform.children.add(rotatetrans); transform.children.add(translatetrans); m3d.transform = transform; group.children.add(m3d); i using code load .obj file. mold of object should load texture

android - What is the purpose of the scale argument in functions such as setYLabelsColor()? -

in achartengine library, class xymultipleseriesrenderer has 2 functions: public void setxlabelscolor(int color) public void setylabelscolor(int scale, int color) setxlabelscolor() intuitively makes sense since 1 needs pass in color, longest time not figure out 'scale' argument setylabelscolor did. docs says, "renderer scale", not apparently clear values scale be. after messing around inputs, got function work 'scale' value of 0. not make intuitive sense me. thought scale value of 1 mean chart keeps scale. why value of 0 work, whereas default scale value of 1 doesn't? take @ below image. there 2 lines in there, scaled in separate way, "air temperature" on left having scale = 0 , "sunshine hours" on right having scale = 1. pic http://www.achartengine.org/dimages/multiple_axis_cubic_line.png

python - mapreduce wordcount example in using Octo module -

i started learn mapreduce octo module word count example. try count words in dir hw3data (as specified below). pc works both server , client. i started windows cmd 2 terminals server: octo.py server wordcount.py seems server side started without problem client: octo.py client localhost seems python can't find txt files stored in hw3data dir, says no work, sleeping. can help? the wordcount.py code below wordcount.py server import glob text_files=glob.glob('c:/python27/octopy-0.1/hw3data/*.txt') def file_contents(file_name): f=open(file_name) try: return f.read() finally: f.close() source=dict((file_name,file_contents(file_name)) file_name in text_files) f=open('outfile','w') def final(key,value): print key,value f.write(str((key,value))) client def mapfn(key,value): line in value.splitlines(): word in line.split(): yield word.lower(),1 def reducefn(key,value

User Mode Virtual Midi Cable Driver -

i 'm looking way create user mode virtual midi cable driver. unfortunately there's nothing @ msdn, , in msdn forums asked nobody sure how should implemented. first, possible? second, 'm not sure if information @ msdn applicable umdf. anyone has more clues have? best regards. this (unfortunately) rather difficult task accomplish in windows. best bet use midiox's yoke junction create virtual device communicate through.

image - PHP Get File Contents -

i'm getting error can't figure out, i'm doing have string or bunch of urls , i'm putting them array , looping array , resizing , uploading images,but im getting error. appreciated! error file_get_contents(http://a513.phobos.apple.com/us/r1000/094/purple/v4/d4/e4/02/d4e402a3-a485-4d4c-cf9b-90b0af391626/mzl.wbbwbbab.png ) [function.file-get-contents]: failed open stream: http request failed! http/1.0 400 bad request in "my file" on line 53 php include("picture-resize.php"); $image = $_post['thumbnail']; $slug = $_post['slug']; $images = $_post['screenshots']; $list = explode(",", $images); $listlength = count($list); $i = 0; $image = $_post['thumbnail']; $path = parse_url($image, php_url_path); $filename = $slug.'-'.$i; $extension = pathinfo($path, pathinfo_extension); $file = $filename.'.'.$extension; file_put_contents(

Advanced javascript game in php -

my goal javascript code wordpress php , have no clue how go doing without getting error message. end goal have javascript game embeded on wordpress page. i've checked dozens of other articles none specific enough code this. code i'm looking include php below dummy website links. can me! in advance. <script src="http://www.java.com/js/deployjava.js"></script> <script> var attributes = { codebase: 'my_website', code: 'vnes.class', archive: 'my_website', width: 512, height: 480 }; var parameters = { sound: "on", timeemulation: "on", fps: "off", stereo: "off", rom: "my_website/game.zig", showsoundbuffer: "off", scale: "on", scanlines: "off", nicesound: "on", romsize: 40976 }; deployjava.setinstallertype('online'); // deployjava.setinstallerty

c++ - When to use pointers/objects in class design -

i know design decision behind using pointer or object in class. e.g. below code class abc; class base { private: abc* m_abcptr; //or abc m_abcobj; }; if can give example application point of view, great. a non-pointer type object deleted when goes out of scope. useful internal class members implementing raii pattern. a pointer-type object must deleted manually. use pointer-style object when life-cycle of object not related life-cycle of object owns it, or objects not owned object, , provided collaborator other classes.

sql server - What is the query for this complex job -

Image
i have following tables materials groups ------------------------------- |grpid | grpname | grpparentid | ------------------------------- materials -------------------------------------- |matid | matname | matgroupid |price | -------------------------------------- stores ----------------------------- |stid | stname | stparentid | ----------------------------- billtype -------------------- |typeid | typename | -------------------- those types store out store in/price sales return first period inventory sales end period inventory store out/price purchase store in ready product in purchase return sales return1 raw materials out bills ---------------------------------- |billid | billtype| client..|....| ---------------------------------- billitems --------------------------------- |itemid| matid| quantity|billid | --------------------------------- the required show report in form i think it's big miss , don't know do i tried joins , pivots ,, got incomplete rep

ios - How to set the text position in video using CATextLayer in iphone? -

i setting text using catextlayer in video using avmutablecomposition , text being displayed not able set position on screen ... using code text being displayed gets displayed on left side of screen , gets cut half... is there 1 me sort out problem.i got struck here , not able find solution ..pls me out code used ... avassettrack *clipvideotrack = [[videoasset trackswithmediatype:avmediatypevideo] objectatindex:0]; [compositionvideotrack inserttimerange:cmtimerangemake(kcmtimezero, videoasset.duration) oftrack:clipvideotrack attime:kcmtimezero error:nil]; [compositionvideotrack setpreferredtransform:[[[videoasset trackswithmediatype:avmediatypevideo] objectatindex:0] preferredtransform]]; cgsize videosize = [clipvideotrack naturalsize]; uiimage *myimage = [uiimage imagenamed:[arrclipart objectatindex:selectedclipart.tag-200]];//<=======================code set image using calayer calayer *alayer = [calayer layer]; alayer.contents = (id)myimage.cgimage; alayer.frame =

css - jQuery modal height is too small -

i have dialog pops on $(document).ready(function() { , blocks whole page modal : true . $(function () { $("#dialog").dialog({ show: { effect: 'drop', direction: "up" }, hide: "explode", modal: true, draggable: false, resizable: false }); }); the problem when $(document).ready(function() { fires, images in page may not loaded. it results in having overlay's height smaller page is. (ex :) have page 2 images (height of 100px). when $(document).ready(function() { fires, have height of 800px, overlay appears, height of 800px. after that, when images had time load, have 1000px page... if scroll down, there 200px @ bottom not blocked overlay. what i'm trying is, when $(window).load(function() { fire (so loaded), refresh height of overlay, if dialog had not been closed of course . i noticed that, once of image

android - Handling touch Events for all layouts in xml -

i have linear layout contains 5 linear layouts child. want handle touch event each child linear layouts. layout looks this <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/container"> <linearlayout android:id="@+id/item1" android:layout_width="match_parent" style="@style/navlinkitemcontainer" android:layout_height="wrap_content"> <textview style="@style/navilinkselected" android:text="first"/> </linearlayout> <linearlayout android:id="@+id/item2" android:layout_width="match_parent" style="@style/navlinkitemcontainer" android:layout_height="wrap_content"> <textview

PopUp Alarm on selected days and selected time in android -

i want popup alarm on selected day i.e. monday ,tuesday , on. , @ selected time on every week. i've idea interval don't know how next day , popup alarm ? you need use alarmmanager , wakeclock while processing intent in service (make sure release , chose right kind). here great example : https://stackoverflow.com/a/8801990/220710 to day current day of week, @ question : android: how current day of week (monday, etc...) in user's language? then use : setinexactrepeating(int type, long triggeratmillis, long intervalmillis, pendingintent operation) schedule repeating alarm has inexact trigger time requirements; example, alarm repeats every hour, not @ top of every hour. then need set : type = rtc_wakeup intervalmillis = ms in week triggeratmillis = system.currenttimemillis() + ms next monday, tuesday or whatever intent = intent want fire service process it.

image - Converting array into grayscale in matlab -

i trying plot set of data in grayscale. however, image seems blue. i have set of data, albedo ranges [0, 0.068] , 1x1 double . my code is: px,py albedomax = 0.0679; albedomin = 0; out_im(px,py) = 1/(albedomax-albedomin)*(albedo - albedomin); imshow(out_im); drawnow; end basically px,py image coordinates have iterate over, , formula trying map input range of [0, 0.068] [0 1] . however, running code, notice output blueish. wondering went wrong. thanks help. can't make use of rgb2gray function?

entity framework - How to implement a Quartz.NET job in ASP.NET MVC with UnitOfWorkPattern on EF Code first -

i have asp.net mvc 3.0 application, ef code first data layer. have implemented unit of work pattern, i’m binding context of unit of work on httpcontext.current.items[somekey] collection. unit of work created , committed in onactionexecuting/executed events on controller. i’m instantiating repositories using windsor castle. now need use quartz.net run job periodically in app, job need use few repositories. problem is, in schedulerjob implementation, there no httpcontext available (indeed). how can instantiate repository (which takes unitofworkfactory constructor parameter) quartz.net job in case? how can substitute missing httpcontext? need implement unitofworkfactory, i’m not sure can bind context , how register different factory quartz.net thread. can please show me way or pattern? thank you. the unit of work implementation belongs business logic layer , should not depend on specific presentation layer such mvc. i made custom unitofworkscope i've used in couple

vb.net - Populating multiple textboxes with data at once -

i have form containing 6 groupboxes, each groupbox containing 180 textboxes, along 2 combobxes. on selecting value first combobox, second combobox gets filled required data table. requirement upon selecting value second combobox, filtered data same table should fill remaining textboxes. code using follows: private sub combobox2_selectedindexchanged(byval sender system.object, byval e system.eventargs) handles combobox2.selectedindexchanged dim strconnection string = "provider=microsoft.jet.oledb.4.0; data source=c:\\users\\brisingr\\documents\\123\database.mdb" dim objconnection new oledbconnection(strconnection) dim strsql string 'strsql = "select * '" & combobox1.text & "' style = '" & combobox2.text & " '" dim string dim b string dim c string dim d string = "select * [" b = combobox1.text c = "] style = [" d = combobox2.text s

java - Passing values to sharedState parameter in LoginModule -

the loginmodule interface has method: public void initialize(subject subject, callbackhandler callbackhandler, map<string, ?> sharedstate, map<string, ?> options); i can pass values options (fourth parameter) extending configuration: public class customconfiguration extends configuration { private map<string, ?> options; private string loginmodulename; public customconfiguration() { } public customconfiguration(final string loginmodulename, final map<string, ?> options) { this.loginmodulename = loginmodulename; this.options = options; } @override public appconfigurationentry[] getappconfigurationentry(string name) { appconfigurationentry entry = new appconfigurationentry(loginmodulename, appconfigurationentry.loginmodulecontrolflag.required,

iphone - iPhone4 different behavior for different signing identities -

we have app, try distribute. have 2 different signing identities. when signing 1 of them, works fine on iphone4. using other one, app can't installed on iphone4 config utility giving error: 'this application not support device's cpu type'. on iphone5, installation both identities works fine, too. experienced this? the signing identity shouldn't cause architecture related issues on describe: 'this application not support device's cpu type'. make sure set "build active architectures only" (project > build settings > build active architectures only) no , try again. the following scenario cause problem: "build active architectures only" set yes, you've connected iphone 5 via usb selected launch destination in scheme selection menu. the ipa file created these settings run on armv7s devices (currently iphone 5 , ipad 4). connecting , selecting iphone 4 produce armv7 ipa should run on armv7s machines too. (c

java - How to implement a list of a specific concrete class from the abstract class? -

i have abstract class "actor" , should generate list (arraylist, maybe best option) of 1 of concrete classes implemented, lets use "actor1". there 3 or more concrete classes actor1,2,3... made using factory method , of them must have list of actor1(s) created. any suggestion? ok, didn't expected such fast response. well, don't start with, of code this, far: public abstract class actor implements iactor { protected coordinates coordinates; protected list<actor> actor1; public actor(coordinates coordinates) { this.coordinates = coordinates; //how implemet list? } public coordinates getlocation() { return coordinates; } public void setcoordinates(coordinates coordinates) { this.coordinates = coordinates; } i make actor generic type bounded itself, , restrict further in concrete subclasses. public abstract class actor<a extends actor<a>> { public list<a&g