Posts

Showing posts from August, 2014

facebook - PHP FB Login not working -

i trying create fb login page in php not working. on chrome, blank page, on ie error 500 (page cannot displayed). have curl extension on php installation, have enabled on php.ini file. have created app on facebook. url have put http://localhost/appname testing purposes. code ripped off developers.facebook.com. can please walk me through on going wrong? thanks. <?php require_once('facebook.php'); $config = array( 'appid' => 'xxxx', 'secret' => 'xxxxx', 'allowsignedrequest' => false // optional should set false non-canvas apps ); $facebook = new facebook($config); $user_id = $facebook->getuser(); ?> <html> <head></head> <body> <?php if($user_id){ try{ $user_profile = $facebook->api('/me','get'); echo "name: " . $user_profile['name']; } catch(facebookapiexception $e){ $login_url = $face

JavaScript vs php amazon api -

so amazon product advertising api in php don't want slow down servers there way use amazon api client side instead of sever side? or php script not effect severs performance on large scale? thank answers. we update 600,000 listings in 1 feed , 400,000 in another.the speed of each little under 30 seconds. the key plausible figure out flat file feeds(while way harder)first because speed of call based more on number of queries rather file size. this because amazon runs query system. means accept feed, tell received it, , undisclosed time later process is. to answer question, way know if fits system build , see.

jasper reports - How to remove unnecessary wrapping in PDF, generated using JasperReports (jrxml)? -

Image
i using jasper report generating pdf report. use following textfield configuration in jrxml file. <textfield isstretchwithoverflow="true" isblankwhennull="true"> <reportelement uuid="ec0e2f1f-82d6-46fd-ba68-394be7f6b015" positiontype="float" stretchtype="relativetotallestobject" isprintrepeatedvalues="false" mode="transparent" x="0" y="0" width="100" height="16" isprintinfirstwholeband="true" isprintwhendetailoverflows="true"/> <box toppadding="2" leftpadding="5" bottompadding="0" rightpadding="0"> <pen linecolor="#757575"/> <toppen linewidth="0.0"/> <leftpen linewidth="1.0"/> <bottompen linewidth="1.0&qu

Shared objects in Python -

i have few objects, should have shared fields. of them may strings or other immutables. how can share them in best way? variant write container manually. class shared(object): def __init__(self, what_to_share): self.inner_value = what_to_share @property def value(self): return self.inner_value @value.setter def value(self, new_value): self.inner_value = new_value

c# - Using custom type resolver -

i'm trying deserialize yaml document standard .net objects, such string scalar values , dictionary<string, object> mappings, using yamldotnet library. i guess deserializer class best option, output object , dictionary<object> . tried implementing custom inodetyperesolver this: class mynodetypereslover : inodetyperesolver { bool inodetyperesolver.resolve(nodeevent nodeevent, ref type currenttype) { if (currenttype == typeof(object)) { if (nodeevent sequencestart) currenttype = typeof(list<object>); else if (nodeevent mappingstart) currenttype = typeof(dictionary<string, object>); else if (nodeevent scalar) currenttype = typeof(string); return true; } return false; } } and using this: deserializer deserializer = new deserializer(); deserializer.typeresolvers.add(new mynodetypereslover()); var res = deser

java - How to display table from the database using json response in Android? (I'm getting JsonArray Fail error in this code) -

this attendance.java file package com.glbwebsim; import java.io.bufferedreader; import java.io.inputstream; import java.io.inputstreamreader; import org.apache.http.httpentity; import org.apache.http.httpresponse; import org.apache.http.client.httpclient; import org.apache.http.client.methods.httppost; import org.apache.http.impl.client.defaulthttpclient; import org.json.jsonarray; import org.json.jsonexception; import org.json.jsonobject; import android.app.activity; import android.graphics.color; import android.os.bundle; import android.util.log; import android.view.view; import android.widget.button; import android.widget.tablelayout; import android.widget.tablerow;` import android.widget.textview; import android.widget.toast; import android.widget.tablerow.layoutparams; public class attendance extends activity { static inputstream istream = null; static jsonarray jarray = null; static string json = ""; public void oncreate(bundle savedinstan

java - For loop inside of for loop not executing -

the second loop executing first number(999) in first loop. trying have second loop execute each number 999-101 in second. int num1 = 999; int num2 = 999; int test1 = 0; string test = ""; for(; num1!=110; num1--){ system.out.println("--------"+num1); for(; num2!=100; num2--){ system.out.println("++++++++"+num2); test1 = num1*num2; test = string.valueof(test1); //system.out.println("checkpoint 2"+"--------------"+test1); if(test.length()==5){ if(test.charat(0)==test.charat(5) && test.charat(1)==test.charat(4) && test.charat(2)==test.charat(3)){ system.out.println("checkpoint 1"+"----------"+test); break; } else{ //system.out.println("fail 1"); } } } } after first run of second loop num2 has value 100 statement num2!=100

javascript - How can I edit a column when I double click on it? -

i using table view of data, table looks below <table> <tr> <th>id</th> <th>name</th> <th>salary</th> </tr> <tr> <td>1</td> <td>imthi</td> <td>30000</td> </tr> </table> i want edit salary column in above table when double click column. can me achieve this? demo check link. used ajax ---------description------ common.php <?php // array or retrieve values database , store array $employeearray[1] = array('id'=>1,'name'=>'john','salary'=>30000); $employeearray[2] = array('id'=>2,'name'=>'imthy','salary'=>20000); ?> index.php <script> function editcolumn(id) { var params = 'option=edit&id=' + id ; var divid = 'edit_' + id; ajax_function('ajax_edit.php', params, divid); }

java - how do i print a "get" methods return value to console -

hello im trying out basic java skills. here code package bankaccount; public class test { string name; int houseno; int balance; test (string n,int h,int b) { n=name; h=houseno; b=balance; } int getbalance(){ return balance; } void setbalance(int newbalance){ newbalance = balance; } } //the class containing main package bankaccount; /** * * @author ideapc */ public class bankaccount { test t1 = new test("tim",147,5); system.out.println(t1.getbalance() + "name ="); public static void main(string[] args) { } } i trying print balance of object t1 (tim) console using system.out.println what doing wrong here? put system.out.println() inside main() method. public class bankaccount { public static void main(string[] args) { test t1 = new test("tim",147,5); system.out.println("name = "+t1.getbalance()); } } y

css - Why is there more gap under logo on contact page? -

Image
if see 2 images above, see 1 has more gap under logo. both pages have same styles don't understand why there more gap on 1 of them. the page correct gap under logo @ http://snapnsolve.com/index.html , page more gap http://snapnsolve.com/contactus.html can point out problem? highly appreciated. it because id #topsochd has height of 60px in index page, has height of 40px in contactus.html. change 60px in contactus.html also. hence in contactus.html: #topsochd { height: 60px;/*not 40px*/ background-color: #ffffff; color: #fff; width: 100%; z-index: 99999; } adding float property in top-left -logo interfering problem. remove float property , instead put position:absolute automatically float logo left. #top-left-logo { position: absolute; }

ios - Access properties from UIView subclass -

i have pretty cluttered display need textfield, 9 uilabels , 9 uibuttons lines connecting them in inverted-tree shape. created on code. in order tiddy uiviewcontroller display code such constraints , display-realted, i've created subclass of uiview. inside subclass of uiview i've created labels , buttons public properties. on storyboard changed class of self.view new subclass created. when run simulator displays correctly wanted. the problem comes when try access public properties of subclass i've created, instance when try change label's text. when type on viewcontroller xcode doesn't show properties i've set previously. now don't know if approach straight-on wrong or if i'm missing something. better create subclass of uiviewcontroller , work on there? any appreciated greatly. override view property in interface extension: #import "customview.h" @interface viewcontroller () @property (nonatomic, strong) customview *

How to get data from observablecollection and display into console application in c#? -

how data observablecollection object , display console application using c#? example: observablecollection<classname> object1= method(parameters); here need print data containing in object1. since object1 collection, how want print data. assuming want print each object in each line. (int = 0; < object1.count; i++) { console.writeline(string.concat(object1[i].item1, "---", object1[i].item2) }

Convert numbers into corresponding letter using Python -

i wondering if possible convert numbers corresponding alphabetical value. so 1 -> 2 -> b i planning make program lists alphabetical combinations possible length specified user. see know how build rest of program except this! wonderful. import string x, y in zip(range(1, 27), string.ascii_lowercase): print(x, y) or import string x, y in enumerate(string.ascii_lowercase, 1): print(x, y) or for x, y in ((x + 1, chr(ord('a') + x)) x in range(26)): print(x, y) all of solutions above output lowercase letters english alphabet along position: 1 ... 26 z you'd create dictionary access letters (values) position (keys) easily. example: import string d = dict(enumerate(string.ascii_lowercase, 1)) print(d[3]) # c

javascript - window.open() opening same link twice -

i creating chrome extension clothing website releases items @ time. extension looks set of links contain keywords. if finds links, opens them. if not, refreshes page. accomplish using javascript , jquery. script injected via background script & tabs. here code: if ($("body").hasclass(" products us")) { var firstitem_link = $("a[href*='mizuno']").attr('href'); var seconditem_link = $("a[href*='schott']").attr('href'); if (firstitem_link && seconditem_link) { window.open(firstitem_link); window.open(seconditem_link); } else { window.location.reload(true); } } when use code , finds links, opens them numerous times, opposed once each. how can fix this?

netlogo - How to ask one or two turtles (if any are present) to do an action? -

the following code finds patches there @ least 1 male , 1 female present, on each such patch, has 1 female hatch offspring turtle of random gender. turtles-own [ gender] setup ask patches [ sprout 1 [set size 0.2 set color pink set gender "female" ]] ask patches [ sprout 1 [set size 0.2 set color blue set gender "male" ]] reset-ticks end to-report parents-here? ;; patch procedure report any? turtles-here [gender = "male"] , any? turtles-here [gender = "female"] end go ask patches [parents-here?] [ ask one-of turtles-here [gender = "female"] [ hatch 1 [ set gender one-of ["male" "female"] ] ] ] tick end instead of asking 1 female hatch, want ask if 1 female present ask hatch " or " if 2 females present ask them hatch ( minmum 1 , maximum two). tried write it ask n-of 2 turtles-here ............ but had error said patch has 1 turtles i tried use

ruby on rails - Is it possible to use "number_to_currency" inside a controller? -

i a, building dropdown menu in form displays list of available options , prices in form: "service - price". problem, however, doesn't can use number_to_currency inside controller. there way achieve same effect, or access number_to_currency controller? here initial effort: @levels = [] distributorlevel.all.each |d| price = (d.price > 0) ? number_to_currency(d.price) : "free" @levels << ["#{d.name} - #{price}", d.id] end yes, with: view_context.number_to_currency(d.price) or actioncontroller::base.helpers.number_to_currency(d.price)

c++ - What is/are G_STMT_START and G_STMT_END? -

i'm in process of porting code gimp source code base program writing. part of code (/gimp-2.8.10//modules/display-filter-color-blind.c) references macro called gimp_cairo_argb32_set_pixel (gimp-2.8.10//libgimpcolor/gimpcairocolor.h). within macro there called g_stmt_start/g_stmt_end. compiler (mac osx via xcode default compiler) complaining error "use of undeclared identifier 'g_stmt_start'" know not scoping issue put macros (in header file called globals.h include in .h) because compiler not complaining gimp_cairo_argb32_set_pixel define. does know whats going on here? i've attempted grep through instances of g_stmt_start in gimp source have not found seems define g_stmt_start/g_stmt_end. found sort of an explanation in gimp toolkit documentation , it's far helpful (for me @ least). this full macro trying use: /** * gimp_cairo_argb32_set_pixel: * @d: pointer destination buffer * @r: red component, not pre-multiplied * @g: green component, n

c# - why Request.IsAuthenticated return true but session is null -

in asp.net mvc project. use area named office . area |--office |--controllers |--accountcontroller |-- methods: index (authorized) controllers |--homecontroller |-- methods: index (not required authorized) share folder in project( not in area ) contains: _loginpartial.chtml, _layout.chtml (use _loginpartial.chtml) this code in _loginpartial.chtml: @if (request.isauthenticated) { <div class="dropdown"> <span data-toggle="dropdown"> <span><b>hello</b></span> <span><b>@user.identity.name</b></span> </span> <ul class="dropdown-menu" role="menu" aria-labelledby="dlabel"> <li role="presentation"> <a role="menuitem" tabindex="-1" href="/office/account/password">change password</a>

arrays - copying files from one folder to another only if their file name is a in a specified text file c# -

i need copy files 1 folder if file name in text file. text file set so file1.jpg file2.jpg file3.jpg etc there around one-million files copy. i'm using c#. what best way go be? i'm not sure if should first read file names text file , put them in list possibly convert list in array maybe use array somehow? or maybe there's better way go it? i know how read , write files , how copy 1 source destination another. don't know how filter out specific files when copying 1 source destination though. any appreciated. thank you. the following code process want string source = @"c:\sourcepath\"; string destination = @"c:\destinationpath\"; string[] strfiles = file.readalltext(@"c:\filename.txt").split(' '); (int = 0; < strfiles.length; i++) { file.copy(source + strfiles[i], destination + strfiles[i]); }

jquery - Why does Bootstrap Tooltip not work correctly when placed inside a table? -

i trying place tooltip on table elements ( td ). although, when tooltip displayed, changes width of td element, though tooltip has position of absolute . why this? demo tooltip inserts div after specified dom element. in case, div inserted between tds, messes render flow (block vs table display). effectively, browser trying render zero-width div td border styling. update code specify valid parent element. commonly body element used. invoke $(selector).tooltip({container:'body'}); updated fiddle: http://jsfiddle.net/8s2sr/1/ if you're having hard time viewing hover state in browser inspector, right click element , preserves state inspection.

android - Google+ sign in without google+ profile -

according post: http://googleplusplatform.blogspot.com/2013/12/google-sign-in-improvements11.html and excerpt: https://developers.google.com/+/api/auth-migration#all-users google+ sign-in provides support users google account, if have not yet created google+ profile. app can use https://www.googleapis.com/auth/plus.login scope or basic profile scope: [...] profile scope - adding google+ sign-in button profile scope provides simple, secure way authenticate users access user's basic information. users not prompted create google+ profile. i gather no longer required have google+ account use google+ oath2.0 authentication google pushing on, great! when use example code fragment: googleapiclient googleapiclient = new googleapiclient.builder(this) .addconnectioncallbacks(this) .addonconnectionfailedlistener(this) .addapi(plus.api, null) .addscope(new scope("profile")) .build(); it still asks me 'upgrade' account google+

spring mvc - Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.2.16 -

as add line <html lang="en" ng-app="myapp"> i getting error uncaught error: [$injector:modulerr] http://errors.angularjs.org/1.2.16/$injector/modulerr?p0=mctapp&p1=error%3a…rg%2f1.2.16%2f%24injector%2fnomod%3fp0%3dmctapp%0a%20%20%20%20at%20error%2...<omitted>...1) i have added these scripts <script type="text/javascript" src="/resources/js/lib/angular.min.js"></script> <script type="text/javascript" src="/resources/js/lib/angular-route.min.js"></script> <script type="text/javascript" src="/resources/js/lib/angular-resource.min.js"></script> javascript app code angular.module('myapp', []).config(mctrouter); function mctrouter($routeprovider) { $routeprovider .when('/', { templateurl: 'home.jsp' }); } you forgot inject ngroute app. inject like angular.module('myapp&#

regex - Grepping rails log in logstash, greediness captures all requests -

i have such pattern in logstash multiline filter: filter { multiline { pattern => "^started.*activerecord: ([0-9]+\.[0-9]{1})ms\).+?" negate => true => "previous" stream_identity => "%{host}.%{path}.%{type}" } } but problem here expression captures rails requests, till end of log file. how tell expression stop @ first match? try instead: ^started.*?activerecord: ([0-9]+\.[0-9]{1})ms\).*?$

glassfish - Javassist ClassCastException in Hibernate and Netbeans -

Image
could me this, have happened making application generate error. following tutorial on using hibernate in netbeans . after getting line "from film", according tutorial executed test read records of film table result error below. googled find do, have seen far it's reported javassist jar file existing in different directories. one, in hibernate (hibernate 4.x-javassist-3.15.0.ga) directory, found out true, , other in glassfish (glassfish server 4) directory. tried searching in glassfish lib directory, nothing seems exist. java.lang.classcastexception: dvdstore.language_$$_javassist_4 cannot cast javassist.util.proxy.proxyobject @ org.hibernate.proxy.pojo.javassist.javassistlazyinitializer.getproxy(javassistlazyinitializer.java:147) @ org.hibernate.proxy.pojo.javassist.javassistproxyfactory.getproxy(javassistproxyfactory.java:71) @ org.hibernate.tuple.entity.abstractentitytuplizer.createproxy(abstractentitytuplizer.java:631) @ org.hibernate.persister.en

android - Add only top and bottom border on LinearLayout -

i add bottom , top border on linearlayout . have tried : <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:bottom="1dp" android:top="1dp"> <shape android:shape="rectangle"> <solid android:color="#ffffff" /> <stroke android:width="1dp" android:color="#000" /> </shape> </item> </layer-list> but add border around shape.. could me please ? make two file , put this code . can set border top , bottom border, main.xml <textview android:text="this textline" android:background="@drawable/border_set" /> border_set.xml this file located full path project_root/res/drawable/border_set.xml <?xml version="1.0" encoding="utf-8"?> <l

Excel Attachment sent via php mail() is corrupted -

am using below code send excel file attachment. <?php ini_set ("smtp","smtp.smpt.com"); ini_set ("sendmail_from","from.com"); $date=date("l js \of f y"); $to = 'my mail id'; $from = 'from mail id'; $replyto = 'from mail id'; $fileatt="zxxxxxyyyyyy.xls"; $subject = 'tran data rejects of ' .$date; $message= "hi team, please find attached file having tran data rejects of today thanks, edw support"; $flags = 'style="display:none;"'; $attachment = chunk_split(base64_encode(file_get_contents($fileatt))); $filename = $fileatt; $boundary =md5(date('r', time())); $headers = "from: mail\r\nreply-to: mail"; $headers .= "\r\nmime-version: 1.0\r\ncontent-type: multipart/mixed; boundary=\"_1_$boundary\""; $message="this multi-part message in mime format. --_1_$boundary con

cordova - i get this alert in my app , only in android.Created with phonegap -

i need find alert on app phonegap , pooshwoosh notification. alert on android. <?xml version="1.0" encoding="utf-8"?> <!-- config.xml reference: https://build.phonegap.com/docs/config-xml --> <widget xmlns = "http://www.w3.org/ns/widgets" xmlns:gap = "http://phonegap.com/ns/1.0" id = "........." version = "1.0.1"> <name>....</name> <description> .... </description> <author ..... </author> <!-- enable individual api permissions here. "device" permission required 'deviceready' event. --> <feature name="http://api.phonegap.com/1.0/device" /> <gap:plugin name="org.apache.cordova.device" version="0.2.8" /> <!-- if not want permissions added app, add following tag config.xml; still have

r - Looking for a more concise way to recategorise a variable -

i have vector of integer ages want turn multiple categories: ages <- round(runif(10, 0, 99)) now want variable binned 3 categories, depending on age. want output object, ages.cat this: young mid old 1 0 0 1 2 1 0 0 3 1 0 0 4 1 0 0 5 1 0 0 6 0 1 0 7 1 0 0 8 0 0 1 9 0 1 0 10 0 1 0 at present creating object following code: ages.cat <- array(0, dim=c(10,3)) # create categorical object 3 bins ages.cat[ages < 30, 1] <- 1 ages.cat[ages >= 30 & ages < 60, 2] <- 1 ages.cat[ages >= 60, 3] <- 1 ages.cat <- data.frame(ages.cat) names(ages.cat) <- c("young", "mid", "old") there must faster , more concise way recode data - had play dplyr couldn't see solution particular problem functions. ideas? what's 'canonical' solution problem in base r or using package? whatever alternatives, i'm they'll more co

c# - EntityFramework Group by not included in SQL statement -

i'm trying create query similar this: select randomid myview ... group randomid note: ef doesn't support distinct thinking of going around lack of group by (or think) randomid numeric entity framework v.6.0.2 this gives me expected result in < 1 second query when trying same ef have been having issues. if linq similar this: context.myview .where(...) .groupby(mt => mt.randomid) .select({ id = group.key, count = group.count() } ) i sort of same result forcing count , making query > 6 seconds the sql ef generates this: select 1 [c1], [groupby1].[k1] [randomid], [groupby1].[a1] [c2] ( select [extent1].[randomid] [k1], count(1) [a1] [dbo].[myview] [extent1] (...) group [extent1].[randomid] ) [groupby1] but, if query had count commented out < 1 second if change select like: .select({ id = group.key} ) i of rows without group by statement in sql query , no distinct whatsoever: select [extent1]

android - ToggleButton makes mediaplayer play twice at once -

i have mediaplayer plays music in activity below. thing is, music transfers other activities , thats fine. when start music, go activity , come activity below, togglebutton has changed on off. therefore, if click on togglebutton, music starts again though music still playing music playing twice @ once! how make togglebutton know music playing when come activity, togglebutton "on" beginning? it's "off" default. public class spelaactivity extends activity { @override protected void oncreate (bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_spela); final mediaplayer mediaplayer = mediaplayer.create(getbasecontext(), r.raw.ljudfil); togglebutton musikknapp = (togglebutton) findviewbyid(r.id.togglemusik); musikknapp.setoncheckedchangelistener (new compoundbutton.oncheckedchangelistener() { public void oncheckedchanged(compoundbutton buttonview, boolean ischecked) { i

c# - Contextmenu showmodal -

as see contextmenu has show() . not showmodal() . what need sure user clicked on item in menu. user must click on of it. i can on closing event cancel property. when set cancel true - winforms allows select treeview's node (contextmenu tree node). so how make context menu modal ? for have write this void contextmenutreeview_closed(object sender, toolstripdropdownclosedeventargs e) { if (e.closereason == toolstripdropdownclosereason.itemclicked) return; if (treeview.selectednode != null && treeview.selectednode.tag != null) { if (changecustomereventhandler != null) changecustomereventhandler(this, new customertreenodeeventargs((guid)treeview.selectednode.tag)); } else { if (newcustomereventhandler != null) newcustomereventhandler(this, eventargs.empty); } } you cannot show standard menus in modal way hope do. that's n

python - Passing string of entry to another function with tkinter -

i'm using python3, trying pass user has typed in username , password box login function when press login button. , login functions should pack label of username onto gui. code: import tkinter tkinter import * import sys def login_gui(): global login_window global studentid_entry_login usr_login = stringvar() pwd_login = stringvar() login_window=tkinter.tk() login_window.title("login") login_window.geometry("200x200+500+300") username_label_login = tkinter.label(login_window, text="username:").pack() username_entry_login = tkinter.entry(login_window, textvariable=usr_login).pack() password_label_login = tkinter.label(login_window, text="\npassword:").pack() password_entry_login = tkinter.entry(login_window, textvariable=pwd_login).pack() button_login = tkinter.button(login_window, text="login", command = login).pack() login_window.mainloop() def login(): username = usr

windows - Kill a process using its PID in ruby -

i'm trying kill process using pid after given period of time, i.e, if process keeps running more 10 minutes, have call method kill it. i have 2 problems: first, can't manage kill process, i'm using: process.kill('int', pid) but errors keep popping bad file descriptor , or unsupported name 'sigquit' when use quit signal instead of int . second, how make 10 minutes timer before call method kill process? thanks. for timing, can use thread: thread.new sleep 10 * 60 begin process.kill('quit', pid) rescue errno::esrch # process exited end end _, status = process.wait2 pid puts status.exited? i unsure of why quit not working you. not replicate error.

java - OpenGL JOGL camera perspective -

i have drawn 3 boxes each same size having different distance camera. these boxes ought perceived decreasing in size moving away camera. how acheive illusion of distance. //these 3 planes boxes // first plane gl.glvertex3i(0, 30, 30); gl.glvertex3i(10, 30, 30); gl.glvertex3i(10, 20, 30); gl.glvertex3i(0, 20, 30); //2nd plane gl.glvertex3i(20, 20, 37); gl.glvertex3i(30, 20, 37); gl.glvertex3i(30, 10, 37); gl.glvertex3i(20, 10, 37); //3rd plane gl.glvertex3i(40, 10, 45); gl.glvertex3i(50, 10, 45); gl.glvertex3i(50, 0, 45); gl.glvertex3i(40, 0, 45); //and eye @ code. gl.glmatrixmode(gl2.gl_modelview); gl.glloadidentity(); glu.glulookat( 35, 15, 10, 25, 15, 30, 0, 1, 0 ); gl.glmatrixmode(gl2.gl_projection); gl.glloadidentity(); gl.glortho(-50.0, 50.0, -30.0, 30.0, 0.0, 60.0); you need use perspective projection, instead of orthographic projection. instead of calling gl.glortho(

ios - Delete all my data in my Core Data store -

i have followed variety of posts here in delete data app can start over. have tried: a) deleting data: nsarray *entities = model.entities; (nsentitydescription *entitydescription in entities) { [self deleteallobjectswithentityname:entitydescription.name incontext:context]; } if ([context save:&error]) { ... - (void)deleteallobjectswithentityname:(nsstring *)entityname incontext:(nsmanagedobjectcontext *)context { nsfetchrequest *fetchrequest = [nsfetchrequest fetchrequestwithentityname:entityname]; fetchrequest.includespropertyvalues = no; fetchrequest.includessubentities = no; nserror *error; nsarray *items = [context executefetchrequest:fetchrequest error:&error]; (nsmanagedobject *managedobject in items) { [context deleteobject:managedobject]; nslog(@"deleted %@", entityname); } } b) delete physical data store: nserror *error; nspersistentst

vb.net - How to keep a Timer running after a program is closed? -

i have vb.net program uses timer 20 seconds. when program runs, timer works fine until finishes (for 20 seconds). problem if close program after 10 seconds, timer stops well. however, want code allows timer continue running until finishes remaining 10 seconds. question is, possible use timer , make run after program closed? alternatively, there other ways accomplish want (example: keep timeofday.ticks run if close program)? solutions appreciated. thanks, a-tech i'm not sure can continue run after closing, can postpone application closing following code. public class form1 dim closer boolean = false private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click timer1.enabled = true label1.text = "timer started" end sub private sub timer1_tick(byval sender system.object, byval e system.eventargs) handles timer1.tick timer1.enabled = false label1.text = "timer stopped" if closer

php - Get everything between strings and replace with something else -

i trying between {code} tags $html string. so far have written doesn't work expected, replacing first {code} also work many code tags, haven't gotten far yet. <?php $html = <<< eot <p>lorem ipsum dolor sit amet, consectetur adipiscing elit.</p> <p>{code}my test code 1{/code}</p> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit.</p> eot; $startpos = strpos($html, '{code}'); $endpos = strpos($html, '{/code}'); if($startpos !== false && $endpos !== false){ $startpos += 6; # strlen('{code}') $endpos += 7; # strlen('{/code}') // code $code = substr($html, $startpos, $endpos); // remove code apart start {code} $html = substr($html, $startpos-6, $endpos); // replace new code $new_code = 'test'; $html = str_replace('{code}', $new_code, $html); } echo $html; result : - http://codepad.viper-7.com/t9sbbn testmy te

watir - Can you change the browser profile in Ruby WQatir / Selenium mid-stream? -

i know can set special profile designating myprofile , saying browser = watir::browser.new :firefox, :profile => myprofile but possible declare browser = watir:browser.new :firefox to start out test standard profile , switch myprofile later? syntax that? can define scenario ? because, had done profile related things, had not need change profile later. had set profile @ beginning of file tell firefox not appear it's download prompt dialog box, download file @ told destination. so, interesting know why trying change profile later.

regex - Perl: grep is matching when it should not -

sub process_ignore{ $col_ref = shift; $ignore_ref = shift; foreach ( @{$ignore_ref} ) { if ( grep( /^$_$/, @{$col_ref})) { print "will ignore column: $_\n" if $debug; } else { print "will not ignore column: $_\n because not valid column" if $debug; } } if ($debug) { foreach $val ( @{$col_ref} ) { print "$val\n"; } } } &process_ignore(\@cols, \@ignores) -- @cols have a_id, status, stime @ignores have a_id, sdd output: ignore column: a_id ignore column: sdd a_id status stime i m not sure why going the matching if block when should not. there no sdd in @cols also, grep ignore case? i.e a_id vs a_id? replace: foreach ( @{$ignore_ref} ) { if ( grep( /^$_$/, @{$col_ref})) { to(at least): foreach $ignore ( @{$ignore_ref} ) { if ( grep( /^$ignore$/, @{$col_ref})) { or even(if regexp not necessary):

sql - MIN and MAX Oracle 10g -

i have table sales column , date of sales column, , want select min , max , date of min , max response single max date , single min date, in oracle, don't know how it, idea? thanks from explanation looks need below: 1) select sales , date table_name sales = ( select min(sales) table_name) 2) select sales , date table_name sales = ( select max(sales) table_name) in single query select sales , date table_name sales = ( select min(sales) table_name) union select sales , date table_name sales = ( select max(sales) table_name)

java - the import com.viewpagerindicator cannot be resolved -

Image
i newbie android. question maybe silly you, forgive me. receiving android project , open in adt. when open project there 2 errors in 2 java files, the import com.viewpagerindicator cannot resolved in problems. have searched google , find it's using viewpagerindicator . , jar name android-support-v4.jar . checked project libs folder there android-support-v4.jar , it's in android private libraries . i thought maybe it's not configured in build path. checked java build path tab in project properties window, it's in libraries tab. screenshot below: am missing anything? appreciated. you need include project android library project , seems haven't done this. from " including in project " section android-viewpagerindicator presented android library project. standalone jar not possible due theming capabilities offered indicator widgets. you can include project referencing library project in eclipse or ant. download source o

java - android app parse values through intent -

i trying parse value through intent while switching between activities. know should read values last intent getextra don't know why doesn't work. also when switch between activities on button click, application crashes. in activity main read text edittext , put in intent : public void schimba(view view){ int value = integer.parseint(instances.gettext().tostring());; intent intent = new intent(this, tabel.class); intent.putextra("max", value); startactivity(intent); } when switch activity 2 have this: intent intentobject = getintent(); int value; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); value = intentobject.getintextra("max", 0); /* for(i=0;i<=value;i++) { layoutinflater layoutinflate = null; layoutinflate = (layoutinflater) getsystemservice(context.layout_inflater_service); final view rowview = layoutinflate.inflate( r.l