Search Results

Search found 509 results on 21 pages for 'ar'.

Page 13/21 | < Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >

  • Target iframe Raphael Js

    - by user299343
    Ive been trying to target iframe using Raphael JS heres some sample code var c = paper.circle(10, 10, 10); c.attr({href: "http://google.com/", target: "top"}); v var t = paper.text(250, 50, "Raphaël\nkicks\nbutt!"); t.attr({href: "http://google.com/", target: "_blank"}); Also..cant get href to work with text ar t = paper.text(50, 50, "Raphaël\nkicks\nbutt!"); t.attr({href: "http://google.com/", target: "_blank"});

    Read the article

  • Rails link to current page and passing parameters to it

    - by Faisal
    I am adding I18N to my rails application by passing the locale using url params. My urls are looking like http://example.com/en/users and http://example.com/ar/users (for the english and arabic locales respectively). In my routes file, I have defined my routes with a :path_prefix option: map.resources :users, :path_prefix => '/:locale' And locale is being set using a before_filter defined in ApplicationController def set_locale I18n.locale = params[:locale] end I also defined ApplicationController#default_url_options, to add locale to all urls generated by the application: def default_url_options(options={}) {:locale => I18n.locale} end What I want is to add a link in the layout header (displayed in all pages) that would link to the same page but with the other locale. For instance, if I am browsing the arabic locale, I want a "English" link in the header, that will redirect me back to my current page, and set the locale to english. Is there a way to do this in rails?

    Read the article

  • Silverlight Project - Setting Reference to Copy Local false not working.

    - by cmaduro
    Why is it that when my Silverlight project is built, the output directory contains a bunch of culture specific directories: ar\System.Windows.Controls.resources.dll bg\System.Windows.Controls.resources.dll ca\System.Windows.Controls.resources.dll etc etc etc Also the root of the build output contains: System.Xml.Linq.dll System.windows.Controls.dll I have gone through the projects in my solution and made sure that "Copy Local" is set to false for all the referances of the mentioned dll files. Those 2 files were set to true, but I did switch them to false. Despite my effort to google an answer, I remain stuck.

    Read the article

  • How do I install PHP with JSON and OAuth on Mac Snow Leopard?

    - by meilas
    I want to use the Dropbox API via this library, http://code.google.com/p/dropbox-php/. I installed MAMP, and then I tried sudo pecl install oauth but I got the following. >>>> downloading oauth-1.0.0.tgz ... Starting to download oauth-1.0.0.tgz (42,834 bytes) ............done: 42,834 bytes 6 source files, building running: phpize Configuring for: PHP Api Version: 20090626 Zend Module Api No: 20090626 Zend Extension Api No: 220090626 building in /var/tmp/pear-build-root/oauth-1.0.0 running: /private/var/tmp/apache_mod_php/apache_mod_php-53~1/Build/tmp/pear/temp/oauth/configure checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for a sed that does not truncate output... /opt/local/bin/gsed checking for cc... cc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether cc accepts -g... yes checking for cc option to accept ISO C89... none needed checking how to run the C preprocessor... cc -E checking for icc... no checking for suncc... no checking whether cc understands -c and -o together... yes checking for system library directory... lib checking if compiler supports -R... no checking if compiler supports -Wl,-rpath,... yes checking build system type... i686-apple-darwin10.4.0 checking host system type... i686-apple-darwin10.4.0 checking target system type... i686-apple-darwin10.4.0 checking for PHP prefix... /usr checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib checking for PHP extension directory... /usr/lib/php/extensions/no-debug-non-zts-20090626 checking for PHP installed headers prefix... /usr/include/php checking if debug is enabled... no checking if zts is enabled... no checking for re2c... no configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers. checking for gawk... gawk checking for oauth support... yes, shared checking for cURL in default path... found in /usr checking for ld used by cc... /usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld checking if the linker (/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld) is GNU ld... no checking for /usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld option to reload object files... -r checking for BSD-compatible nm... /usr/bin/nm checking whether ln -s works... yes checking how to recognise dependent libraries... pass_all checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking dlfcn.h usability... yes checking dlfcn.h presence... yes checking for dlfcn.h... yes checking the maximum length of command line arguments... 196608 checking command to parse /usr/bin/nm output from cc object... rm: conftest.dSYM: is a directory rm: conftest.dSYM: is a directory rm: conftest.dSYM: is a directory rm: conftest.dSYM: is a directory ok checking for objdir... .libs checking for ar... ar checking for ranlib... ranlib checking for strip... strip rm: conftest.dSYM: is a directory rm: conftest.dSYM: is a directory checking if cc static flag works... rm: conftest.dSYM: is a directory yes checking if cc supports -fno-rtti -fno-exceptions... rm: conftest.dSYM: is a directory no checking for cc option to produce PIC... -fno-common checking if cc PIC flag -fno-common works... rm: conftest.dSYM: is a directory yes checking if cc supports -c -o file.o... rm: conftest.dSYM: is a directory yes checking whether the cc linker (/usr/libexec/gcc/i686-apple-darwin10/4.2.1/ld) supports shared libraries... yes checking dynamic linker characteristics... darwin10.4.0 dyld checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... no >>>> creating libtool appending configuration tag "CXX" to libtool configure: creating ./config.status config.status: creating config.h running: make /bin/sh /private/var/tmp/pear-build-root/oauth-1.0.0/libtool --mode=compile cc -I. -I/private/var/tmp/apache_mod_php/apache_mod_php-53~1/Build/tmp/pear/temp/oauth -DPHP_ATOM_INC -I/private/var/tmp/pear-build-root/oauth-1.0.0/include -I/private/var/tmp/pear-build-root/oauth-1.0.0/main -I/private/var/tmp/apache_mod_php/apache_mod_php-53~1/Build/tmp/pear/temp/oauth -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -Wall -g -c /private/var/tmp/apache_mod_php/apache_mod_php-53~1/Build/tmp/pear/temp/oauth/oauth.c -o oauth.lo mkdir .libs cc -I. "-I/private/var/tmp/apache_mod_php/apache_mod_php-53~1/Build/tmp/pear/temp/oauth" -DPHP_ATOM_INC -I/private/var/tmp/pear-build-root/oauth-1.0.0/include -I/private/var/tmp/pear-build-root/oauth-1.0.0/main "-I/private/var/tmp/apache_mod_php/apache_mod_php-53~1/Build/tmp/pear/temp/oauth" -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -Wall -g -c "/private/var/tmp/apache_mod_php/apache_mod_php-53~1/Build/tmp/pear/temp/oauth/oauth.c" -fno-common -DPIC -o .libs/oauth.o In file included from /private/var/tmp/apache_mod_php/apache_mod_php-53~1/Build/tmp/pear/temp/oauth/php_oauth.h:47, from /private/var/tmp/apache_mod_php/apache_mod_php-53~1/Build/tmp/pear/temp/oauth/oauth.c:14: /usr/include/php/ext/pcre/php_pcre.h:29:18: error: pcre.h: No such file or directory In file included from /private/var/tmp/apache_mod_php/apache_mod_php-53~1/Build/tmp/pear/temp/oauth/php_oauth.h:47, from /private/var/tmp/apache_mod_php/apache_mod_php-53~1/Build/tmp/pear/temp/oauth/oauth.c:14: /usr/include/php/ext/pcre/php_pcre.h:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token /usr/include/php/ext/pcre/php_pcre.h:38: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token /usr/include/php/ext/pcre/php_pcre.h:44: error: expected specifier-qualifier-list before 'pcre' make: *** [oauth.lo] Error 1 ERROR: `make' failed </block>

    Read the article

  • Delegate, BeginInvoke. EndInvoke - How to clean up multiple Async threat calls to the same delegate?

    - by Dan
    I've created a Delegate that I intend to call Async. Module Level Delegate Sub GetPartListDataFromServer(ByVal dvOriginal As DataView, ByVal ProgramID As Integer) Dim dlgGetPartList As GetPartListDataFromServer The following code I use in a method Dim dlgGetPartList As New GetPartListDataFromServer(AddressOf AsyncThreadMethod_GetPartListDataFromServer) dlgGetPartList.BeginInvoke(ucboPart.DataSource, ucboProgram.Value, AddressOf AsyncCallback_GetPartListDataFromServer, Nothing) The method runs and does what it needs to The Asyn callback is fired upon completion where I do an EndInvoke Sub AsyncCallback_GetPartListDataFromServer(ByVal ar As IAsyncResult) dlgGetPartList.EndInvoke(Nothing) End Sub It works as long as the method that starts the BeginInvoke on the delegate only ever runs while there is not a BeginInvoke/Thread operation already running. Problem is that the a new thread could be invoked while another thread on the delegate is still running and hasnt yet been EndInvoke'd. The program needs to be able to have the delegate run in more than one instance at a time if necessary and they all need to complete and have EndInvoke called. Once I start another BeginInvoke I lose the reference to the first BeginInvoke so I am unable to clean up the new thread with an EndInvoke. What is a clean solution and best practice to overcome this problem?

    Read the article

  • OpenGL basics: calling glDrawElements once per object

    - by Bethor
    Hi all, continuing on from my explorations of the basics of OpenGL (see this question), I'm trying to figure out the basic principles of drawing a scene with OpenGL. I am trying to render a simple cube repeated n times in every direction. My method appears to yield terrible performance : 1000 cubes brings performance below 50fps (on a QuadroFX 1800, roughly a GeForce 9600GT). My method for drawing these cubes is as follows: done once: set up a vertex buffer and array buffer containing my cube vertices in model space set up an array buffer indexing the cube for drawing as 12 triangles done for each frame: update uniform values used by the vertex shader to move all cubes at once done for each cube, for each frame: update uniform values used by the vertex shader to move each cube to its position call glDrawElements to draw the positioned cube Is this a sane method ? If not, how does one go about something like this ? I'm guessing I need to minimize calls to glUniform, glDrawElements, or both, but I'm not sure how to do that. Full code for my little test : (depends on gletools and pyglet) I'm aware that my init code (at least) is really ugly; I'm concerned with the rendering code for each frame right now, I'll move to something a little less insane for the creation of the vertex buffers and such later on. import pyglet from pyglet.gl import * from pyglet.window import key from numpy import deg2rad, tan from gletools import ShaderProgram, FragmentShader, VertexShader, GeometryShader vertexData = [-0.5, -0.5, -0.5, 1.0, -0.5, 0.5, -0.5, 1.0, 0.5, -0.5, -0.5, 1.0, 0.5, 0.5, -0.5, 1.0, -0.5, -0.5, 0.5, 1.0, -0.5, 0.5, 0.5, 1.0, 0.5, -0.5, 0.5, 1.0, 0.5, 0.5, 0.5, 1.0] elementArray = [2, 1, 0, 1, 2, 3,## back face 4, 7, 6, 4, 5, 7,## front face 1, 3, 5, 3, 7, 5,## top face 2, 0, 4, 2, 4, 6,## bottom face 1, 5, 4, 0, 1, 4,## left face 6, 7, 3, 6, 3, 2]## right face def toGLArray(input): return (GLfloat*len(input))(*input) def toGLushortArray(input): return (GLushort*len(input))(*input) def initPerspectiveMatrix(aspectRatio = 1.0, fov = 45): frustumScale = 1.0 / tan(deg2rad(fov) / 2.0) fzNear = 0.5 fzFar = 300.0 perspectiveMatrix = [frustumScale*aspectRatio, 0.0 , 0.0 , 0.0 , 0.0 , frustumScale, 0.0 , 0.0 , 0.0 , 0.0 , (fzFar+fzNear)/(fzNear-fzFar) , -1.0, 0.0 , 0.0 , (2*fzFar*fzNear)/(fzNear-fzFar), 0.0 ] return perspectiveMatrix class ModelObject(object): vbo = GLuint() vao = GLuint() eao = GLuint() initDone = False verticesPool = [] indexPool = [] def __init__(self, vertices, indexing): super(ModelObject, self).__init__() if not ModelObject.initDone: glGenVertexArrays(1, ModelObject.vao) glGenBuffers(1, ModelObject.vbo) glGenBuffers(1, ModelObject.eao) glBindVertexArray(ModelObject.vao) initDone = True self.numIndices = len(indexing) self.offsetIntoVerticesPool = len(ModelObject.verticesPool) ModelObject.verticesPool.extend(vertices) self.offsetIntoElementArray = len(ModelObject.indexPool) ModelObject.indexPool.extend(indexing) glBindBuffer(GL_ARRAY_BUFFER, ModelObject.vbo) glEnableVertexAttribArray(0) #position glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, 0) glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ModelObject.eao) glBufferData(GL_ARRAY_BUFFER, len(ModelObject.verticesPool)*4, toGLArray(ModelObject.verticesPool), GL_STREAM_DRAW) glBufferData(GL_ELEMENT_ARRAY_BUFFER, len(ModelObject.indexPool)*2, toGLushortArray(ModelObject.indexPool), GL_STREAM_DRAW) def draw(self): glDrawElements(GL_TRIANGLES, self.numIndices, GL_UNSIGNED_SHORT, self.offsetIntoElementArray) class PositionedObject(object): def __init__(self, mesh, pos, objOffsetUf): super(PositionedObject, self).__init__() self.mesh = mesh self.pos = pos self.objOffsetUf = objOffsetUf def draw(self): glUniform3f(self.objOffsetUf, self.pos[0], self.pos[1], self.pos[2]) self.mesh.draw() w = 800 h = 600 AR = float(h)/float(w) window = pyglet.window.Window(width=w, height=h, vsync=False) window.set_exclusive_mouse(True) pyglet.clock.set_fps_limit(None) ## input forward = [False] left = [False] back = [False] right = [False] up = [False] down = [False] inputs = {key.Z: forward, key.Q: left, key.S: back, key.D: right, key.UP: forward, key.LEFT: left, key.DOWN: back, key.RIGHT: right, key.PAGEUP: up, key.PAGEDOWN: down} ## camera camX = 0.0 camY = 0.0 camZ = -1.0 def simulate(delta): global camZ, camX, camY scale = 10.0 move = scale*delta if forward[0]: camZ += move if back[0]: camZ += -move if left[0]: camX += move if right[0]: camX += -move if up[0]: camY += move if down[0]: camY += -move pyglet.clock.schedule(simulate) @window.event def on_key_press(symbol, modifiers): global forward, back, left, right, up, down if symbol in inputs.keys(): inputs[symbol][0] = True @window.event def on_key_release(symbol, modifiers): global forward, back, left, right, up, down if symbol in inputs.keys(): inputs[symbol][0] = False ## uniforms for shaders camOffsetUf = GLuint() objOffsetUf = GLuint() perspectiveMatrixUf = GLuint() camRotationUf = GLuint() program = ShaderProgram( VertexShader(''' #version 330 layout(location = 0) in vec4 objCoord; uniform vec3 objOffset; uniform vec3 cameraOffset; uniform mat4 perspMx; void main() { mat4 translateCamera = mat4(1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, cameraOffset.x, cameraOffset.y, cameraOffset.z, 1.0f); mat4 translateObject = mat4(1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, objOffset.x, objOffset.y, objOffset.z, 1.0f); vec4 modelCoord = objCoord; vec4 positionedModel = translateObject*modelCoord; vec4 cameraPos = translateCamera*positionedModel; gl_Position = perspMx * cameraPos; }'''), FragmentShader(''' #version 330 out vec4 outputColor; const vec4 fillColor = vec4(1.0f, 1.0f, 1.0f, 1.0f); void main() { outputColor = fillColor; }''') ) shapes = [] def init(): global camOffsetUf, objOffsetUf with program: camOffsetUf = glGetUniformLocation(program.id, "cameraOffset") objOffsetUf = glGetUniformLocation(program.id, "objOffset") perspectiveMatrixUf = glGetUniformLocation(program.id, "perspMx") glUniformMatrix4fv(perspectiveMatrixUf, 1, GL_FALSE, toGLArray(initPerspectiveMatrix(AR))) obj = ModelObject(vertexData, elementArray) nb = 20 for i in range(nb): for j in range(nb): for k in range(nb): shapes.append(PositionedObject(obj, (float(i*2), float(j*2), float(k*2)), objOffsetUf)) glEnable(GL_CULL_FACE) glCullFace(GL_BACK) glFrontFace(GL_CW) glEnable(GL_DEPTH_TEST) glDepthMask(GL_TRUE) glDepthFunc(GL_LEQUAL) glDepthRange(0.0, 1.0) glClearDepth(1.0) def update(dt): print pyglet.clock.get_fps() pyglet.clock.schedule_interval(update, 1.0) @window.event def on_draw(): with program: pyglet.clock.tick() glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT) glUniform3f(camOffsetUf, camX, camY, camZ) for shape in shapes: shape.draw() init() pyglet.app.run()

    Read the article

  • java - register problem

    - by Jake
    Hi! When i try to register a person with the name Eric for example, and then again registrating Eric it works. This should not happen with the code i have. Eric should not be registrated if theres already an Eric in the list. Here is my full code: import java.util.*; import se.lth.cs.pt.io.*; class Person { private String name; private String nbr; public Person (String name, String nbr) { this.name = name; this.nbr = nbr; } public String getName() { return name; } public String getNumber() { return nbr; } public String toString() { return name + " : " + nbr; } } class Register { private List<Person> personer; public Register() { personer = new ArrayList<Person>(); } // boolean remove(String name) { // } private Person findName(String name) { for (Person person : personer) { if (person.getName() == name) { return person; } } return null; } private boolean containsName(String name) { return findName(name) != null; } public boolean insert(String name, String nbr) { if (containsName(name)) { return false; } Person person = new Person(name, nbr); personer.add(person); Collections.sort(personer, new A()); return true; } //List<Person> findByPartOfName(String partOfName) { //} //List<Person> findByNumber(String nbr) { //} public List<Person> findAll() { List<Person> copy = new ArrayList<Person>(); for (Person person : personer) { copy.add(person); } return copy; } public void printList(List<Person> personer) { for (Person person : personer) { System.out.println(person.toString()); } } } class A implements Comparator < Person > { @Override public int compare(Person o1, Person o2) { if(o1.getName() != null && o2.getName() != null){ return o1.getName().compareTo(o2.getName()); } return 0; } } class TestScript { public static void main(String[] args) { new TestScript().run(); } void test(String msg, boolean status) { if (status) { System.out.println(msg + " -- ok"); } else { System.out.printf("==== FEL: %s ====\n", msg); } } void run() { Register register = new Register(); System.out.println("Vad vill du göra:"); System.out.println("1. Lägg in ny person."); System.out.println("2. Tag bort person."); System.out.println("3. Sök på del av namn."); System.out.println("4. Se vem som har givet nummer."); System.out.println("5. Skriv ut alla personer."); System.out.println("0. Avsluta."); int cmd = Keyboard.nextInt("Ange kommando (0-5): "); if (cmd == 0 ) { } else if (cmd == 1) { String name = Keyboard.nextLine("Namn: "); String nbr = Keyboard.nextLine("Nummer: "); System.out.println("\n"); String inlagd = "OK - " + name + " är nu inlagd."; String ejinlagd = name + " är redan inlagd."; test("Skapar nytt konto", register.insert(name, nbr) == true); System.out.println("\n"); } else if (cmd == 2) { } else if (cmd == 3) { } else if (cmd == 4) { } else if (cmd == 5) { System.out.println("\n"); register.printList(register.findAll()); System.out.println("\n"); } else { System.out.println("Inget giltigt kommando!"); System.out.println("\n"); } } }

    Read the article

  • ffmpeg 0.5 flv to wav conversion creates wav files that other programs won't open.

    - by superrebel
    Hi, I am using the following command to convert FLV files to audio files to feed into julian, a speech to text program. cat ./jon2.flv | ffmpeg -i - -vn -acodec pcm_s16le -ar 16000 -ac 1 -f wav - | cat - > jon2.wav The cat's are there for debugging purposes as the final use will be a running program that will pipe FLV into ffmpeg's stdin and the stdout going to julian. The resulting wave files are identified by "file" as: jon3.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 16000 Hz VLC (based on ffmpeg) plays the file, but no other tools will open/see the data. They show empty wav files or won't open/play. For example Sound Booth from CS4. Has anyone else had similar problems? Julian requires wav files 16bit mono at 16000 Hz. Julian does seem to read the file, but doesn't seem to go through the entire file (may be unrelated). Thanks, -rr

    Read the article

  • UriBuilder incorrectly encoding Query Parameters value ?

    - by Fred
    Lets consider the following code sample where a path and single parameter are encoded... Parameter name: "param" Parameter value: "foo/bar?aaa=bbb&ccc=ddd" (happens to be a url with query parameters) String test = UriBuilder.fromPath("https://dummy.com"). queryParam("param", "foo/bar?aaa=bbb&ccc=ddd"). build().toURL().toString(); The encoded URL string returned is: "https://dummy.com?param=foo/bar?aaa%3Dbbb&ccc%3Dddd" Is this correct ? Should not the character "&" (and may be even "?") be encoded in the parameter value string ? Would not the URL produced be interpreted as follow: One first parameter, name="param", value = "ar?aaa%3Dbbb" followed by a second parameter, name="ccc%3Dddd", without value.

    Read the article

  • SSRS 2008 export to MS Word A4 issue

    - by Knut Ivar
    I have a simple report maid in bids 2008 and deployed to a ssrs2008 server. it has this report properties: page unit : Centimeters page size : Orientasion: Landscape paper sise: A4 width : 29,7cm Height: 21cm all margins ar 2,5cm Showing and printing this report works fine making it perfekt on a A4 paper. exporting to difrent formats works also grate exept the format i made the report for. The word files ither end up whit an letter paper size or a A3 size. Do enyone have a solution for this problem?

    Read the article

  • Attaching a static library to an iphone/ipad application

    - by Jack
    Hello, which is the best approach to include a static library with into an application for iPhone or iPad? I could choose to compile the library supplying right platform and building a library file with the ar utility and then add as a framework to the project including the source of the library .c/.h and compile them together with the application The first approach seems simpler, because I won't care about managing all specific settings of the library I want to include but how can I create the library both for iPhone and iPad and allow xcode to use the right library upon linking? The second approach seems more complex since xcode will take care about compiling my application and the library (with different settings I suppose) then how should I go? I can easily add sources of the lib but I'll have to include the make scripts to allow xcode use them to build in the right way. Any suggestions about how to proceed? The library I'm trying to include is libssh. (I know that this library, of course, has already been compiled and tried succesfully on iPhone) Thanks in advance.

    Read the article

  • Rails polymorphic associations, two assoc types in one class

    - by snitko
    Consider a class: class Link < ActiveRecord::Base has_many :link_votes, :as => :vote_subject, :class_name => 'Vote' has_many :spam_votes, :as => :vote_subject, :class_name => 'Vote' end The problem is, when I'm adding a new vote with @link.link_votes << Vote.new the vote_subject_type is 'Link', while I wish it could be 'link_votes' or something like that. Is this an AR limitation or is there a way to workaround this thing? I've actually found one related answer, but I'm not quite sure about what it says: http://stackoverflow.com/questions/1168047/polymorphic-association-with-multiple-associations-on-the-same-model/1764117#1764117

    Read the article

  • Converting Asynchronous Programming Model (Begin/End methods) into event-based asynchronous model?

    - by David
    Let's say I have code that uses the Asynchronous Programming Model, i.e. it provides the following methods as a group which can be used synchronously or asynchronously: public MethodResult Operation(<method params>); public IAsyncResult BeginOperation(<method params>, AsyncCallback callback, object state); public MethodResult EndOperation(IAsyncResult ar); What I want to do is wrap this code with an additional layer that will transform it into the event-driven asynchronous model, like so: public void OperationAsync(<method params>); public event OperationCompletedEventHandler OperationCompleted; public delegate void OperationCompletedEventHandler(object sender, OperationCompletedEventArgs e); Does anyone have any guidance (or links to such guidance) on how to accomplish this?

    Read the article

  • VIsual Studio and Ajax Control Toolkit

    - by Steve
    In my web application VS 2008 solution, I have the AjaxControlToolkit.dll in my bin directory and a whole set of language directories for it (ar, cs, de,es, fr, he, etc...) I don't remember how the language directories got in there. If I am using other languages via the ACT, do I need these directories? If not, then I don't? When I do a rebuild solution, the dll (AjaxControlToolkit.resources.dll) in these directories disappear. If I need them, what do I need to do to keep them from being deleted during a rebuild?

    Read the article

  • shell script redirect output

    - by Andy
    I have a shell script to monitor process due to preventing the process closed. If the process is closed, that script will restart it. BTW, when the system starts, the crontab will run the script automatically. How can I get the output of the process which started by the shell script? #!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH while : do if [ -z "$(ps -ef | grep -v grep | grep 225.0.6.4)" ]; then date +"%m-%d-%y %T" >> /home/andy/log/stream.log echo "225.0.6.4 - 103 not worked and restart process" >> /home/andy/log/stream.log echo "225.0.6.4 - 103 not worked and restart process" /usr/bin/tzap -a 1 -c /home/andy/channels.conf -o - -r -p "D" | /home/andy/ffmpeg -f mpegts -i pipe:0 -c:v libx264 -preset medium -crf 23 -bufsize 3000K -minrate 1200k -maxrate 1200k -pix_fmt yuv420p -g 50 -s 1024x768 -acodec libmp3lame -b:a 128k -ac 2 -ar 44100 -f mpegts udp://225.0.6.4:50000 & fi sleep 1 done

    Read the article

  • Cannot access a web page? [closed]

    - by ipkiss
    Hello all, Recently, I could not access the webpage bbc.co.uk anymore, while I can access other websites smoothly. Ar first, I though there may be some problem with my laptop. However, if I use my laptop through my company network, I can load the page bbc.co.uk normally. Then, I though maybe my ADSL at home blocks that web address. However, I tried another laptop with my home ADSL and it can load the page bbc.co.uk very fast. Now I do not know what could be the problem. Can anyone tell me please? Thank you.

    Read the article

  • GNU ld removes section

    - by Jonatan
    I'm writing a boot script for an ARM-Cortex M3 based device. If I compile the assembler boot script and the C application code and then combine the object files and transfer them to my device everything works. However, if I use ar to create an archive (libboot.a) and combine that archive with the C application there is a problem: I've put the boot code in a section: .section .boot, "ax" .global _start _start: .word 0x10000800 /* Initial stack pointer (FIXME!) */ .word start .word nmi_handler .word hard_fault_handler ... etc ... I've found that ld strips this from the final binary (the section "boot" is not available). This is quite natural as there is no dependency on it that ld knows about, but it causes the device to not boot correctly. So my question is: what is the best way to force this code to be included?

    Read the article

  • Need a way for users to enter data while offline and re-submit it when back online

    - by crankharder
    As part of a larger webapp, I want to build functionality that allows a user to enter data while offline -- and then send that data back to my site when they have a connection again The parts that, to me, are missing ar Saving a certain set of data in their browser Saving a form that allows them to enter data using form from step#2 to update data from step#1 getting data out of the local data store and sending it back to the server I would like to keep this entirely within the browser, so... Does HTML5 meet some (or all) of those goals as it's currently implemented in webkit/ff3? If not,what technologies should I start looking into in order to accomplish all of the above.

    Read the article

  • to_xml with :only and :methods

    - by Jake
    I'm calling to_xml on an ActiveRecord object with both :only and :methods parameters. The method that I'm including returns a collection for AR objects. This works fine without the :only param, but when that is added I just get the default to_s representation of my objects. i.e <author><books>#&lt;Book:0x107753228&gt;</books>\n</author> Any ideas? Update, here is the code: class Author < ActiveRecord::Base def books #this is a named scope products.by_type(:book) end end Author.to_xml(:methods => :books, :only => :id)

    Read the article

  • How do I use a Rails ActiveRecord migration to insert a primary key into a MySQL database?

    - by Terry Lorber
    I need to create an AR migration for a table of image files. The images are being checked into the source tree, and should act like attachment_fu files. That being the case, I'm creating a hierarchy for them under /public/system. Because of the way attachment_fu generates links, I need to use the directory naming convention to insert primary key values. How do I override the auto-increment in MySQL as well as any Rails magic so that I can do something like this: image = Image.create(:id => 42, :filename => "foo.jpg") image.id #=> 42

    Read the article

  • Static libraries, dynamic libraries, DLLs, entry points, headers ... how to get out of this alive?

    - by tunnuz
    Hello, I recently had to program C++ under Windows for an University project, and I'm pretty confused about static and dynamic libraries system, what the compiler needs, what the linker needs, how to build a library ... is there any good document about this out there? I'm pretty confused about the *nix library system as well (so, dylibs, the ar tool, how to compile them ...), can you point a review document about the current library techniques on the various architectures? Note: due to my poor knowledge this message could contain wrong concepts, feel free to edit it. Thank you Feel free to add more reference, I will add them to the summary. References Since most of you posted *nix or Windows specific references I will summarize here the best ones, I will mark as accepted answer the Wikipedia one, because is a good start point (and has references inside too) to get introduced to this stuff. Program Library Howto (Unix) Dynamic-Link Libraries (from MSDN) (Windows) DLL Information (StackOverflow) (Windows) Programming in C (Unix) An Overview of Compiling and Linking (Windows)

    Read the article

  • Logic differences in C and Java

    - by paragjain16
    Compile and run this code in C #include <stdio.h> int main() { int a[] = {10, 20, 30, 40, 50}; int index = 2; int i; a[index++] = index = index + 2; for(i = 0; i <= 4; i++) printf("%d\n", a[i]); } Output : 10 20 4 40 50 Now for the same logic in Java class Check { public static void main(String[] ar) { int a[] = {10, 20, 30, 40, 50}; int index = 2; a[index++] = index = index + 2; for(int i = 0; i <= 4; i++) System.out.println(a[i]); } } Output : 10 20 5 40 50 Why is there output difference in both languages, output is understandable for Java but I cannot understand output in C One more thing, if we apply the prefix ++ operator, we get the same result in both languages, why?

    Read the article

  • yiic shell: failed to perform 'crud'

    - by ufw
    Debian Squeeze, PHP 5.3.2-1, Yii 1.1.2, PHP $path to php is /usr/bin/php, permissions are '777'. When I try to run 'crud Test' in yii shell, I get the following error message: PHP Warning: include(/var/www/test/protected/models/Test.php): failed to open stream: No such file or directory in /var/www/yii/framework/YiiBase.php on line 335 PHP Warning: include(): Failed opening '/var/www/test/protected/models/Test.php' for inclusion (include_path='.:/var/www/test/protected/components:/var/www/test/protected/models:/usr/share/php:/usr/share/pear') in /var/www/yii/framework/YiiBase.php on line 335 PHP Fatal error: Class 'Test' not found in /var/www/yii/framework/db/ar/CActiveRecord.php on line 341

    Read the article

  • How can I get the text that was clicked on in Javascript?

    - by Jake
    Does anyone know if it is possible with javascript to to tell the position of a mouse click in some text? I know it's easy to get the x,y coordinates, but I'm wanting the position in the text. For example if I clicked inside <p>foo bar</p> I want to be able to tell that the click was on/after the 5th character. Or that foo b is before the click and ar is after it. By the way, I'm using jQuery too, I'm happy with pure JS and solutions that use jQ. Thanks in advance.

    Read the article

  • FFmpeg bitrate issue.

    - by user329840
    I'm dealing with a very big issue about bit rate , ffmpeg provide the -b option for the bit rate and for adjustment it provide -minrate and -maxrate, -bufsize but it don't work proper. If i'm giving 256kbps at -b option , when the trans-coding finishes , it provide the 380kbps. How can we achieve the constant bit rate using ffmpeg. If their is +-10Kb it's adjustable. but the video bit rate always exceed by 50-100 kbps. I'm using following command ffmpeg -i "demo.avs" -vcodec libx264 -s 320x240 -aspect 4:3 -r 15 -b 256kb \ -minrate 200kb -maxrate 280kb -bufsize 256kb -acodec libmp3lame -ac 2 \ -ar 22050 -ab 64kb -y "output.mp4" When trans-coding is done, the Media Info show overall bit rate 440kb (it should be 320kb). Is their something wrong in the command. Or i have to use some other parameter? Plz provide your suggestion its very important.

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18 19 20  | Next Page >