Posts

Showing posts from 2014

c++ - Opengl obj object loader with textures -

i using object loader load obj model exported blender. can load model none of textures loaded , don't know why. should loaded when render model in main class or need load textures rendering model? objloader.cpp /************************************************************ *loads obj file - limited vertices, faces, normals, texture maps *loads object structure defined in .h file ************************************************************/ #include <stdio.h> #include <iostream> #include <io.h> #include <stdlib.h> #include "glut.h" #include "objloader.h" using namespace std; void object_type::render() { glbegin(gl_triangles); // glbegin , glend delimit vertices define primitive (in our case triangles) (int j=0;j<polygons_qty;j++) { //----------------- first vertex ----------------- //normal coordinates of first vertex glnormal3f( normcoord[ polygon[j].n[0] - 1 ].i, normcoor

python - Incorrect Output While Comparing Two Lists -

i'm trying compare 2 lists generate buy/sell signals. first list list of prices, while second list simple moving average prices. result = [590.0, 600.0, 590.0, 580.0, 570.0, 560.0, 570.0] avrg = [580.0, 590.0, 593.33, 590.0, 580.0, 570.0, 566.67] signal = '' prices in range(len(result)): averages in range(len(avrg)): if result[prices] > avrg[averages]: signal = 'buy' elif result[prices] < avrg[averages]: signal = 'sell' lst.append(signal) output is ['buy', 'buy', 'buy', 'buy', 'buy', 'sell', 'buy'] the output should be ['buy', 'buy', 'sell', 'sell', 'sell', 'sell', 'buy'] result = [590.0, 600.0, 590.0, 580.0, 570.0, 560.0, 570.0] avrg = [580.0, 590.0, 593.33, 590.0, 580.0, 570.0, 566.67] signal = [] in range(len(result)): if (result[i] > avrg[i]): signal.append(&

How to develop and run app for office 2013? -

i want develop app office 2013. problem when searched microsoft developer tools office 2013 find link officedevtoolsforvs2012 . link on blogs on microsoft site msdn.microsoft . downloaded file run web platform api tells me can't find product(i don't know how microsoft link). want know how develop app office using vs2012. update**: i found exe file called officetools_bundle.exe installed required tools when run online samples error unable load 1 or more of requested types. retrieve loaderexceptions property more information. any help. this issue solved not, still don't know what's reason behind it. all did installed fresh windows 7 64bit on machine , every thing working charm.

Adding an array of doubles to an array list gives me weird (hex?) values - java -

i'm getting problems when try add array of doubles arraylist. arraylist<double[]> vok = new arraylist<double[]>(); and method i'm having issues is: public void onsensorchanged(sensorevent e) { if(e.sensor.gettype()==sensor.type_magnetic_field){ double[] temp = new double[3] ; double x = e.values[0]; temp[0]=x; double y = e.values[1]; temp[1]=y; double z = e.values[2]; temp[2]=z; vok.add(temp); system.out.println(vok); } when hover on temp in debug, displays correct values e.g. temp = [40.55999755859375, -20.100000381469727, -28.260000228881836] i in array when added "vok" end symbols [d@419aeb28] in array (hex?). have tried changing method in add elements vok = arrays.aslist(temp) , changing corresponding types i'm still having same problem. i'm not sure if there better method 1 i'm using i've been working on day , closest i've got.

xml - Using XPath - How do I select/count immediate siblings? -

i trying compound immediate following siblings same values together. having trouble select immediate siblings. input: <rows> <row> <month>1</month> <start_date>15/04/2013</start_date> <rate_amount>10</rate_amount> <discount>-2</discount> </row> <row> <month>2</month> <start_date>15/05/2013</start_date> <rate_amount>10</rate_amount> <discount>-2</discount> </row> <row> <month>3</month> <start_date>15/06/2013</start_date> <rate_amount>10</rate_amount> <discount>-5</discount> </row> <row> <month>4</month> <start_date>15/07/2013</start_date> <rate_amount>10</rate_amount> <discount>-2</discount>

xml - Can't get XSL to Display Correctly with XSL Variables and XPATH -

i'm making basic contact list web app 3 pages - contact list page displays contacts in db (stored in xml file), contact view page (that read-only page displays contact information), , new contact page (that allows make new contact or edit information of existing contact). my issue contact view page. each contact has id, , id passed through url (i.e. contactviewer?id=mk). using id, hoping using simple xsl for-each checks url request (saved in xsl variable) pick contact db display work. unfortunately, after adding "for-each" nothing displays on page , can't figure out it's going wrong. this xsl page contactview. <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:param name="url"/> <xsl:variable name="currentid" select="substring-after($url, 'id=')"/> <xsl:template

android - Use onChildClickListener with ExpendableListView -

how use onclicklistener expendable list view in such way clicking child item creates new activity? i did guy made don't have idea how make child item create new activity. explained bit in comments don't know go after expandlistchild ch = explistitems.get(groupposition).getitems().get(childposition); i included expandlist.setonchildclicklistener(expandlist_itemclicked); on oncreate method. know have 'ch' variable, don't know values corresponding clicked item are. can please help? onchildclick (expandablelistview parent, view v, int groupposition, int childposition, long id) when childclick listener called information need, ch not needed.

c++ - How to hint OpenMP Stride? -

i trying understand conceptual reason why openmp breaks loop vectorization. suggestions fixing helpful. considering manually parallelizing fix issue, not elegant , result in massive amount of code bloat, code consists of several such sections lend vectorization , parallelization. i using microsoft (r) c/c++ optimizing compiler version 17.00.60315.1 x64 with openmp: info c5002: loop not vectorized due reason '502' without openmp: info c5001: loop vectorized the vs vectorization page says error happens when: induction variable stepped in manner other simple +1 can force step in stride 1? the loop #pragma omp parallel for (int j = 0; j < h*w; j++)//a,b,c,d,in __restricted { float gs = d[j]-b[j]; float gc = a[j]-c[j]; in[j]=atan2f(gs,gc); } best effort(?) #pragma omp parallel {// seems vectorize, still requires quite lot of boiler code int middle = h*w/2; #pragma omp sections nowait { #pragma omp sect

jekyll - Fenced Code Block Styling in Ordered List -

Image
i using fenced-code-blocks in ordered-list. code have is 1. download , extract `jre-7u21-linux-i586.gz` `/usr/java` `/usr/java` directory should similar this, ``` /usr/java |-- jdk1.6.0_43 |-- jre1.7.0_21 ``` 2. tell `alternatives` have installed new `java` using octopress markdown config set redcarpet (instead of default rdiscount ), following see. as notice, "line-number vertical line" got moved way right in code block. how "move" line-number area left, , show line number? or, if that's not possible, can please me remove "right vertical bar" altogether? have here : https://github.com/imathis/octopress/pull/814 hope help. i found best solution might using html tags instead. using plugins solve confusing.see example1 example2 <ol> <li> download , extract `jre-7u21-linux-i586.gz` `/usr/java` `/usr/java` directory should similar this, ``` /usr/java |-- j

ruby on rails - Partial locals are not being passed -

i'm trying pass locals partial render in rails, not getting passed. <%=render :partial => "search_results", :locals => {:refinement => "all", :query => params[:search]}%> the partial being rendered in view has param[:search] in it, params[:search] accessable inside of partial without being passed in local. i'm trying access locals refinement , query doing params[:refinement] , params[:query] inside of partial, not being recognized. you don't access them via params - access local variable, eg. refinement or query .

visual studio - Why won't this program work in release mode? -

#include <iostream> #include <fstream> #include <stdlib.h> // includes "atoi" function #include <string> using namespace std; #include <sstream>; int main() { std::fstream f; f.open("file.in", std::fstream::in); // read data int count = 0; std::string line = ""; getline( f, line, '\n' ); count = atoi( line.c_str() ); f.close(); f.open("file.in", std::fstream::out | std::fstream::trunc); // write data ++count; f << count << endl; f.close(); return 0; } this works in debug mode in visual studio when run application doesn't work. i've initialized variables i'm not sure else check. this line f.open("file.in", std::fstream::in); make sure file.in in \bin\release i advice use try/catch statements , print errors

Android NDK: Linking "error: undefined reference to" GLES functions -

so have following on android.mk.... ... local_c_includes := $(local_path)/include /users/myname/development/android/android-ndk-r8c/platforms/android-14/arch-arm/usr/include ... local_ldlibs := -ldl -lglesv1_cm -llog however, when try running ndk-build following.... /users/myname/development/android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/libsdl.a(sdl_render_gles.o): in function gles_createrenderer:jni/sdl/src/render/opengles/sdl_render_gles.c:189: error: undefined reference 'gldisableclientstate' collect2: ld returned 1 exit status this of course appears issue linking, however, compiler worked fine. confused why linking wouldn't work compilation would. anyonw know how fix it? from ndk-build v=1 >build.log output update: ok taking code found here compiles fine, however, trying upgrade prboom+ dl code here , twea

stack - Flash AS 2, Stacking items in the players inventory -

Image
i have inventory names, , numbers names increase more of same items added. item code: _root.player_inventory = new array(_root.array); (a = 0; < _root.invslots; a++) { _root.player_inventory[a] = "none"; } stacking code: _root.player_inventory[a] = new array(_root.stackamount); (b = 0; b < _root.stackamount; b++) { _root.player_inventory[b] = 0; //player_inventory[a][b] = "[" + + "][" + b + "]"; //mainarraytxt = "[" + + "][" + b + "]"; //b = 0; } my item code fine; add stacking it. i got code tutorial: http://www.newgrounds.com/portal/view/448642 one way of doing is: item code: _root.default_items = ["food","torch","sword","map","hatchet"]; _root.player_inventory = new array(_root.array); (a = 0; < _root.invslots; a++) //fill inventory spots "none" { _root.player_inventory[a] = "n

mysql - Calculate sum of absolute difference in rows by groups -

i have problem have been able solve using stata, data has grown size cannot process memory more. hope in mysql instead. trying calculate manhattan distance of items between n groups. have manipulated data far hope ready work computation: select * exampleshares; +----------+-------------+-------------+ | item | group | share | +----------+-------------+-------------+ | | group1 | .3 | | b | group1 | .7 | | | group2 | .2 | | b | group2 | .6 | | c | group2 | .2 | | | group3 | .3 | | c | group3 | .6 | +----------+-------------+-------------+ the manhattan distance of example : +----------+-------------+-------------+ | groupx | groupy | m distance | +----------+-------------+-------------+ | group1 | group1 | 0 | | group1 | group2 | .4 | | group1 | group3 | 1.3

javascript - Display div's on Menu item click -

i working on site has 1 page, instead of loading different pages different bits of content; want content change not page therefore decreasing loading , creating nice effect. as can see code below it's long works, sure there easier way , animating between divs. http://jsfiddle.net/ssly3/ html <ul class="side-nav" id="sidenav"> <li id="homenav"><a href="#">home</a></li> <li id="bionav"><a href="#">biography</a></li> <li id="musicnav"><a href="#">music</a></li> <li id="photosnav"><a href="#">photos</a></li> <li id="shopnav"><a href="#">shop</a></li> </ul> <div id="homepage"> <p>home page</p> </div> <div id="biogpage"> <p>biog page</p> </div> <

gem install libv8 --version '3.11.8.17' on ruby (windows) -

the problem following. error installing libv8: error: failed build gem native extension. d:/ruby193/bin/ruby.exe extconf.rb creating makefile system can not find specified path d:ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.11.8.17/ext/libv8/builder.rb:49:in'setup_python!':libv8 requires python 2 installed in order build,but not available (runtimeerror) d:ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.11.8.17/ext/libv8/builder.rb:35:in 'block in build_libv8!' d:ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.11.8.17/ext/libv8/builder.rb:34:in 'chdir' d:ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.11.8.17/ext/libv8/builder.rb:34:in 'build_libv8!' d:ruby193/lib/ruby/gems/1.9.1/gems/libv8-3.11.8.17/ext/libv8/builder.rb:34:in 'install!' extconf.rb:7: in '<main>' have installed python27 , add path. python --version python 2.7.4 then check code following. def se

How to copy excel worksheets Into another excel workbook without opening the excel file in c# winforms? -

in c# windows application, have many excel workbooks, want copy worksheets excel workbook single workbook. possible, have open excel workbooks in order so. excel.application app = new excel.application(); app.visible = true; app.windowstate = xlwindowstate.xlminimized; app.workbooks.add(""); app.workbooks.add(@"path\workbook1.xlsx"); app.workbooks.add(@"path\workbook2.xlsx"); (int = 2; <= app.workbooks.count; i++) { int count = app.workbooks[i].worksheets.count; app.workbooks[i].activate(); (int j = 1; j <= count; j++) { excel._worksheet ws = (excel._worksheet)app.workbooks[i].worksheets[j]; ws.select(true); ws.cells.select(); excel.range sel = (excel.range)app.selection; sel.copy(type.missing); excel._worksheet sheet = (excel._wo

Why might I not be getting jQuery global ajax events when using jquery-ujs and Rails? -

example: $('form').on('ajax:success', function() { /* fired */ }); $('form').on('ajaxsuccess', function() { /* not fired */ }); 'ajax:success' documented here : https://github.com/rails/jquery-ujs/wiki/ajax reading jquery documentation on ajax events leads me believe any dom element eligible events (ie: ajaxsuccess). there not seem documentation in jquery-ujs indicate "normal" jquery ajax events not fired. jquery doc excerpt http://api.jquery.com/ajax_events/ global events these events broadcast elements in dom, triggering handlers may listening. can listen these events so:"

c# - In-process cache VS. Out-of-process cache -

i've been working on small webpage display grid-view database table records in. have option user add record db, or update existing record. currently use simple sql queries these , db small it's fine now. though prepare myself larger db's implement caching make display, insert , update commands faster. i've read 2 kinds of caches: in-process cache, , out-of-process cache. can please explain or refer me explanation difference between two, , how implement them azure in c#? suppose want reads in-proc cache , writes out-of-proc cache, can that? thanks in advance i recommend decide on caching mechanism based on application type , requirements. please go through following links azure basics azure client caching strategies high availability caching capacity planning guide also please post additional details community can , suggest right approach. note appfabric supports local caching. can explore on area also.

java - Expandable list in pdf files -

can create expandable list in pdf files. expandable list of form : +item1 +item2 -item3 -subitem3.1 -subitem3.2 +item4 -item5 -subitem5.1 -subitem5.2 -subitem5.3 also need create pdf file java(i thinking of using itext, library better/easier?). possible. or report in other standard format(not pdf or html) easier way out. first this: i'm creator of itext, forgive me not pointing other solutions ;-) now question: you're asking dynamic functionality (a tree structure opens/closes upon user interaction) inside pdf document. the obvious answer is: isn't possible. when creating pdf, think of paper. can print tree structure on paper opens/closes when end user touches paper? no, can't, therefore you're asking isn't possible in pdf. the less obvious answer is: depends. type of pdf talking about? if you're talking interactive xfa form, may able achieve want. xml forms architecture (xfa) xml specification can used define interact

Matlab - sort cell array of objects by property -

suppose had class named foo, datenum property named datetime. if had cell array collection of foo objects, how sort according each object's datetime property? i have seen references overloading sort method , working arrays of objects, i'm using cell array due dynamic sizing , instructions aren't holding up. got suggestions? cheers the simplest approach extract time-values vector, sort that, , use new order sort original array. %# extract datetime cell array foocell datetime = cellfun(@(x)x.datetime, foocell); [~,sortidx] = sort(datetime); %# reorder foocell foocell = foocell(sortidx);

php - if statement not working when table = uri -

i have if statement when mysql table = server uri, changes css class, haven't been able work. here code: $adminresults = mysql_query('select * menu_admin position="l"'); $adminresults_array = array(); while ($row = mysql_fetch_assoc($adminresults)) { $img = $row["img"]; $href = $row["location"]; $text = $row["name"]; $uri = $_server["request_uri"]; if ($href == $uri){ $output .= "<li class='active'><a href='$cfg->wwwroot/{$href}'><p class='cssimg'><img src='$cfg->wwwroot/theme/{$img}'/></p><p class='csstxt'>{$text}</p></a></li>"; } else { $output .= "<li><a href='$cfg->wwwroot/{$href}'><p class='cssimg'><img src='$cfg->wwwroot/theme/{$img}'/></p><p class='csstxt'>

Getting the right coordinates of the visible part of a UIImage inside of UIScrollView -

i have uiimage inside uiscrollview can zoom-in , zoom-out, crop, move around, etc. how coordinates of visible part of uiimage inside uiscrollview. want crop image in it's native resolution (using gpuiimage) need x, y, width , height rectangle. i use scrollview enable zoom of uiimage. cropping button presents overlaid resizable cropping view. following code use ensure user defined crop box in uiscrollview gets added correct coordinates uiimageview (can use crop image). to find x , y coordinates use scrollview contentoffset multiplied inverse of zoomscale: float origx = 0; float origy = 0; float widthcropper = 0; float heightcropper = 0; if (_scrollview.contentoffset.x > 0){ origx = (_scrollview.contentoffset.x) * (1/_scrollview.zoomscale); } if (_scrollview.contentoffset.y > 0){ origy = (_scrollview.contentoffset.y) * (1/_scrollview.zoomscale); } if need create sized cropping box displayed in scrollview need adjust width , height zoom factor:

Python ImportError: No module named 'path' -

''' data class''' import os.path random import random class testdata(object, random): def fetchdatafromfile(self, filename): """ open file read """ myfile = open(os.path.join(os.getcwd(),filename), 'r') """ read information in file """ lines = myfile.read() ''' remove header not used ''' header = lines[0] lines.remove(header) return lines i getting: importerror: no module named path file " pyclasspath /lib/testdata.py", line 2, in os.path working in other classes in project. can point me mistake doing? i moved file 1 directory another. apart it, there no difference between class , other classes. import os should work fine instead import os random import random class testdata(object, random): def fetchdatafromfile(self, filename): ""&q

java - Remote lookup using @ejb annotation -

i have 2 servers instances of jboss 5, each of deployed 2 ear's. client.ear , server.ear. server ear expose ejb's. want inject clientear via annotation. using jndi lookup did fine , works. using annotation javax.naming.namingexception. when injecting session beans accross deployment artifacts global jndi name has used injection , used @ejb(mappedname ="java:global/server/component/applicationservice!com.test.server.applicationserviceinterface") but seems not providing provider_url of remote server bound client ear instance. how configure jndi properties, ie provider_url, initial context properites annotation @ ejb? i found forum post answers question: https://community.jboss.org/thread/228789 in refers https://docs.jboss.org/author/display/as71/ejb+invocations+from+a+remote+server+instance and accomplish jndi lookup @ejb annotaion uses @ejb(lookup = "ejb:earname/modulename/beanclass!fully.qualified.remoteinterface") private remoteint

sql - Why the table of my function is not acceptable? -

create or replace package pkg type result_t table of varchar2(3000); function generatef return result_t ; end pkg; / create or replace package body pkg function generatef return result_t i_t result_t := result_t(); begin tlc in 1..3 loop i_t.extend; i_t(i_t.last) := tlc; end loop; return i_t; end; end pkg; / when want execute " select * table(pkg.generatef); ", system tells me there "invalid datatype ". i'm not sure brings issue. this type result_t not globally defined, that's why oracle (or dbms) not identify type , not able cast output table form. you can specify type outside package - create or replace type result_t table of varchar2(3000); and remove definition type package - create or replace package pkg /*type result_t table of varchar2(3000);*/ function generatef return result_t; end pkg; / create or replace package body pkg function generatef return result_t i_t result_t := result_t()

sql server - SQL Query is taking too long to execute -

hi below query written sql 2008. takes more 2 hours insert 500000 records. 1 suggest way improve performance? insert tbluserfile select case when ud.identitystatus = 'a' 'active' when ud.identitystatus in ('t','') 'inactive' when ud.identitystatus null '' end, --'ud.is' "status", isnull(ud.hltid,'') "userid", isnull(ud.hltid,'') "username", isnull(ud.firstname,'') "firstname", isnull(ud.lastname,'') "lastname", isnull(ud.middleinitials,'') "mi", '' "gender", isnull(ud.emailaddress,'') "email", case when su.usertype = 'c' isnull(mcu.manager, '') ----look when su.usertype = 'r' 'from lms superviser' when su.usertype null or su.usertype = '' '' end,

css - How make layout 100% height -

how make simple layout 100% height (sidebar + content)? see source code: http://codepen.io/adilson/pen/kihsd apparently layout seems 100% of height when resizing browser , open "menu item 10" clear not. another problem column "sidebar" border not going bottom of page. edit: not want have scroll bar on sidebar, i'm trying let layout 100% height, , if open menu automatically expand layout. here's example of i'm trying do: http://www.keenthemes.com/preview/metronic/layout_blank_page.html i not want header , footer of model, rest want do. the reason scroll bar more 100% height. you can make them both same height using containers : here's jsfiddle example.

c# - Load large number of images from URL -

i android developer, faced problem of memory exception when loading large number of images listbox . i have no idea windows phone application development kindly suggest better solution load large number of images listbox url in windows phone. code below: public class listboxrows { public string text1 { get; set; } public string imageuri { get; set; } public string text2 { get; set; } public string instid { get; set; } } <image grid.column="0" width="90" height="90" source="{binding imageuri}" ></image> i want know if efficient way load images url. if have huge number of images show memory exception. suggest me better option can load number of images efficiently without memory exceptions. are there external projects achieve goal? while haven't written actual code test this, think right approach here make sure use data virtualization. this article provides

internet explorer - jQuery FlexSlider V2.0 issue in IE 8 -

i'm using flexslider bur issue next/prev. buttons not function in ie. mozilla works per expected. i dynamically binding images flexslider (mvc3.0). flexslider : jquery flexslider v2.0( http://www.woothemes.com/flexslider/ ) below code launch slider: $jq(window).load(function() { $jq('.alternate-images').flexslider({ slideshow:false, animation: "slide", animationloop: false, itemwidth: 61, itemmargin:5, controlscontainer:".alternate-images", controlnav:false, mousewheel:true, move:2, animationduration: 0, directionnav: true, added:function(){ slidecheck(); }, removed:function(){ slidecheck(); } }); }); any ideas overcome issue in ie ? thank you

windows 7 - MSBuild compile error "resgen.exe" .Net FX 3.5 Tools -

im trying compile project made in vs2012 in windows 7 x64. trying compile in virtualmachine windows 7 x86 , .net framework 4.0 installed using msbuild 4.0 error "resgen.exe" , netfx tools 3.5: "c:\users\administrador\appdata\local\temp\virtuosa game packer\virtuosa game p acker.sln" (default target) (1) -> "c:\users\administrador\appdata\local\temp\virtuosa game packer\extractor.vbpro j" (default target) (2) -> (coreresgen target) -> c:\windows\microsoft.net\framework\v4.0.30319\microsoft.common.targets(2291,5 ): error msb3091: task failed because "resgen.exe" not found, or correc t microsoft windows sdk not installed. task looking "resgen.exe" in "bin" subdirectory beneath location specified in installationfol der value of registry key hkey_local_machine\software\microsoft\microsoft s dks\windows\v7.0a\winsdk-netfx35tools-x86. may able solve problem doing 1 of following: 1) install microsoft windows sdk.

sql - Query for selecting Itemnumber from table? -

Image
i have 2 tables 1.inventtable , 2.texttable 1. and next table is 2. i need select itemnumbers second table id!=2 , filename =etable in inventtable.how write query this your query (for sql server): select * inventtable inner join texttable t on t.itemnumber=i.refkey i.id<>2 , i.filename='etable'

user interface - Gerrit Web UI URL -

i'm quite new gerrit.i'm getting permisson denied(public key) while running ssh command .i want add rsa key gerrit profile.but i'm not able take web ui.i tried localhost:29418 nothing come up. thanks in advance!!! if used -b batch mode can find site on http:// localhost :8080 first user login have automatically administration rights , should able enter userid , ssh key. need use userid plus ssh key connect. ssh -p 29418 userid@ 127.0.0.1 gerrit this should show gerrit help.

c# - HTML textarea with image upload -

i'm in need of develop website allow user input information , images <textarea> save database. data displayed in page. i though of using ajax upload file append <img> <textarea> . approach produce sql injection security threat. so need advice on how achieve still can rid of sql injection. when user uploads image, following , safe append image html textarea: is user upload valid jpg/gif/png/x image? (use image libraries verify that.) rename image "safe" crc32 of contents + current time in microseconds file name innocuous. put image new name in location can served.

php - Clear SELECT fields in CodeIgniter -

i'm using function set entire sql query. function used other 2 sql , use need. now, want function execute same query don't need fields previous functions needed. so, want know if there way replace select portion of query after it's set. pseudocode: function sql(){ $this->db->select('*'); $this->db->from('table'); } function defaultsql(){ $this->sql(); $this->get(); } function notallfields(){ $this->sql(); // solution i'm looking for. should clear select $this->db->clearselect(); // define different select $this->db->select('field'); $this->get(); } thanks in advance! can u try way?? function sql($fields = '*') { $this->db->select($fields); $this->db->from('table'); } function defaultsql() { $this->sql(); // ...... } function notallfields() { $this->sql('field'); // ..... }

wso2bam - WSO2 BAM REST-API Sample Execution -

i have wso2bam v2.2.0 installed on windows 7 , cygwin 1.7.18. when try run rest-api sample following error in bam console. can please let me know can wrong , how resolve issue? tid: [0] [bam] [2011-05-14 20:46:05,603] info {org.apache.cassandra.service.gcinspector} - gc marksweepcompact: 408 ms 1 collections, 94079960 used; max 1037959168 {org.apache.cassandra.service.gcinspector} tid: [0] [bam] [2011-05-14 20:46:05,808] error {org.wso2.carbon.analytics.hive.impl.hiveexecutorserviceimpl} - error during query execution.. {org.wso2.carbon.analytics.hive.impl.hiveexecutorserviceimpl} java.util.concurrent.executionexception: java.lang.nullpointerexception @ java.util.concurrent.futuretask$sync.innerget(unknown source) @ java.util.concurrent.futuretask.get(unknown source) @ org.wso2.carbon.analytics.hive.impl.hiveexecutorserviceimpl.execute(hiveexecutorserviceimpl.java:91) @ org.wso2.carbon.analytics.hive.task.hivescriptexecutortask.execute(hivescriptexecutortask.ja

octopress - Why the pygments_code.rb plugin is breaking? -

when run cmd: bundle exec rake generate new octopress blog, fails following exception. $ rake generate ## generating site jekyll identical source/stylesheets/screen.css configuration /users/millisami/code/octopress/_config.yml building site: source -> public /users/millisami/code/octopress/plugins/pygments_code.rb:14:in `highlight': undefined method `[]' nil:nilclass (nomethoderror) /users/millisami/code/octopress/plugins/backtick_code_block.rb:37:in `block in render_code_block' /users/millisami/code/octopress/plugins/backtick_code_block.rb:13:in `gsub' /users/millisami/code/octopress/plugins/backtick_code_block.rb:13:in `render_code_block' /users/millisami/code/octopress/plugins/octopress_filters.rb:12:in `pre_filter' /users/millisami/code/octopress/plugins/octopress_filters.rb:28:in `pre_render' /users/millisami/code/octopress/plugins/post_filters.rb:112:in `block in pre_render' /users/millisami/code/octopress/plugins/post_filte

Double.MaxValue crashes mixed Native/C# application -

we have problem application crashing when calls method uses double.maxvalue . true running in debugger in release version, , happens under 32-bit xp under 64-bit win 7. if in debugger have breakpoint on line calling method using double.maxvalue , attempt execute method (f11, f10, f5) stop application friendly windows message has caused problem , needs terminated. replacing double.maxvalue 9999999999 - ok our application - makes problem go away. looking @ il, literally changes constant. the c# classes being called native code via little c++ mixed mode bridge has native , managed part. our first idea native part might have destroyed managed memory areas - after replacing maxvalue 9999999999 application runs fine, , happily jumps , forth between native , managed part. we don't deliver trial & error software customer, , love hear ideas going on?? --edit-- here cut-down version of bridge still crashes: #include <stdio.h> #include <tchar.h> #include <